├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── ci.yml │ └── codeql-analysis.yml ├── .gitignore ├── Directory.Build.props ├── LICENSE.md ├── README.md ├── ZiggyCreatures.FusionCache.sln ├── benchmarks └── ZiggyCreatures.FusionCache.Benchmarks │ ├── ExecutionBenchmarkAsync.cs │ ├── ExecutionBenchmarkSync.cs │ ├── GlobalSuppressions.cs │ ├── HappyPathBenchmark.cs │ ├── LockerComparisonBenchmark.cs │ ├── ParallelComparisonBenchmark.cs │ ├── Program.cs │ ├── SamplePayload.cs │ ├── SequentialComparisonBenchmarkAsync.cs │ ├── SequentialComparisonBenchmarkSync.cs │ ├── SerializersBenchmark.cs │ └── ZiggyCreatures.FusionCache.Benchmarks.csproj ├── docs ├── AGentleIntroduction.md ├── AdaptiveCaching.md ├── AutoClone.md ├── AutoRecovery.md ├── BackgroundDistributedOperations.md ├── Backplane.md ├── CacheLevels.md ├── CacheStampede.md ├── Clear.md ├── Comparison.md ├── ConditionalRefresh.md ├── CoreMethods.md ├── DependencyInjection.md ├── Diagrams.md ├── DiskCache.md ├── EagerRefresh.md ├── Events.md ├── FactoryOptimization.md ├── FailSafe.md ├── Logging.md ├── Media.md ├── MicrosoftHybridCache.md ├── NamedCaches.md ├── OpenTelemetry.md ├── Options.md ├── PluginSample.md ├── Plugins.md ├── README.md ├── RedisNotes.md ├── Simulator.md ├── StepByStep.md ├── Tagging.md ├── Timeouts.md ├── Update_v0_20_0.md ├── Update_v0_24_0.md ├── Update_v1_0_0.md ├── Update_v2_0_0.md ├── google-award-128x128.png ├── google-award-256x256.png ├── images │ ├── background-distributed-operations.png │ ├── cache-stampede-after.png │ ├── cache-stampede-before.png │ ├── cold-start.png │ ├── crinkle-crankle-wall.jpg │ ├── diagram-extended.png │ ├── diagram.png │ ├── diagrams.png │ ├── factory-optimization.png │ ├── fail-safe-after.png │ ├── fail-safe-before.png │ ├── fusioncache-simulator-autorecovery.png │ ├── horizontal-scalability.png │ ├── opentelemetry-example.png │ ├── redis-logo.png │ ├── stepbystep-00-database.png │ ├── stepbystep-00-nocache.png │ ├── stepbystep-01-memorycache.png │ ├── stepbystep-02-fusioncache.png │ ├── stepbystep-03-failsafe.png │ ├── stepbystep-04-factorytimeouts.png │ ├── stepbystep-05-distributedcache.png │ ├── stepbystep-06-distributedoptions.png │ ├── stepbystep-07-backplane.png │ ├── stepbystep-intro.png │ ├── talk-on-dotnet.jpg │ ├── talks │ │ ├── continuous-delivery.jpg │ │ ├── data-exposed.jpg │ │ ├── dotnet-podcast.jpg │ │ ├── dotnetconf-italia.jpg │ │ ├── live-coding-alla-scoperta-di-fusioncache.jpg │ │ ├── on-dotnet-2025.jpg │ │ ├── on-dotnet-small.jpg │ │ ├── on-dotnet.jpg │ │ ├── open-at-microsoft.jpg │ │ ├── small-talks.jpg │ │ └── spike-time.jpg │ ├── timeouts-timeline-background.png │ └── timeouts-timeline-blocking.png ├── logo-128x128.png ├── logo-256x256.png ├── logo-400x400.png ├── logo-plugin-128x128.png ├── logo-plugin-256x256.png ├── logo-plugin-400x400.png └── mvp-award-128x128.png ├── global.json ├── src ├── ZiggyCreatures.FusionCache.AspNetCore.OutputCaching │ ├── FusionOutputCacheOptions.cs │ ├── FusionOutputCacheServiceCollectionExtensions.cs │ ├── FusionOutputCacheStore.cs │ ├── ZiggyCreatures.FusionCache.AspNetCore.OutputCaching.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Backplane.Memory │ ├── GlobalSuppressions.cs │ ├── MemoryBackplane.cs │ ├── MemoryBackplaneExtensions.cs │ ├── MemoryBackplaneOptions.cs │ ├── MemoryBackplane_Async.cs │ ├── MemoryBackplane_Sync.cs │ ├── ZiggyCreatures.FusionCache.Backplane.Memory.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis │ ├── GlobalSuppressions.cs │ ├── RedisBackplane.cs │ ├── RedisBackplaneOptions.cs │ ├── RedisBackplane_Async.cs │ ├── RedisBackplane_Sync.cs │ ├── StackExchangeRedisBackplaneExtensions.cs │ ├── ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Chaos │ ├── ChaosBackplane.cs │ ├── ChaosDistributedCache.cs │ ├── ChaosException.cs │ ├── ChaosMemoryCache.cs │ ├── ChaosMemoryLocker.cs │ ├── ChaosPlugin.cs │ ├── ChaosSerializer.cs │ ├── FusionCacheChaosUtils.cs │ ├── GlobalSuppressions.cs │ ├── Internals │ │ └── AbstractChaosComponent.cs │ ├── ZiggyCreatures.FusionCache.Chaos.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Locking.AsyncKeyed │ ├── AsyncKeyedMemoryLocker.cs │ ├── StripedAsyncKeyedMemoryLocker.cs │ ├── ZiggyCreatures.FusionCache.Locking.AsyncKeyed.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.MicrosoftHybridCache │ ├── ZiggyCreatures.FusionCache.MicrosoftHybridCache.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.OpenTelemetry │ ├── FusionCacheMetricsInstrumentationOptions.cs │ ├── FusionCacheTracesInstrumentationOptions.cs │ ├── MeterProviderBuilderExtensions.cs │ ├── TracerProviderBuilderExtensions.cs │ ├── ZiggyCreatures.FusionCache.OpenTelemetry.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack │ ├── FusionCacheCysharpMemoryPackSerializer.cs │ ├── FusionCacheCysharpMemoryPackSerializerExtensions.cs │ ├── Internals │ │ ├── SerializableFusionCacheDistributedEntry.cs │ │ └── SerializableFusionCacheEntryMetadata.cs │ ├── ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack │ ├── FusionCacheNeueccMessagePackSerializer.cs │ ├── FusionCacheNeueccMessagePackSerializerExtensions.cs │ ├── ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson │ ├── FusionCacheNewtonsoftJsonSerializer.cs │ ├── FusionCacheNewtonsoftJsonSerializerExtensions.cs │ ├── ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Serialization.ProtoBufNet │ ├── FusionCacheProtoBufNetSerializer.cs │ ├── FusionCacheProtoBufNetSerializerExtensions.cs │ ├── Internals │ │ └── FusionCacheEntryMetadataSurrogate.cs │ ├── ZiggyCreatures.FusionCache.Serialization.ProtoBufNet.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Serialization.ServiceStackJson │ ├── FusionCacheServiceStackJsonSerializer.cs │ ├── FusionCacheServiceStackJsonSerializerExtensions.cs │ ├── ZiggyCreatures.FusionCache.Serialization.ServiceStackJson.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md ├── ZiggyCreatures.FusionCache.Serialization.SystemTextJson │ ├── FusionCacheSystemTextJsonSerializer.cs │ ├── FusionCacheSystemTextJsonSerializerExtensions.cs │ ├── ZiggyCreatures.FusionCache.Serialization.SystemTextJson.csproj │ ├── artwork │ │ └── logo-128x128.png │ └── docs │ │ └── README.md └── ZiggyCreatures.FusionCache │ ├── Backplane │ ├── BackplaneConnectionInfo.cs │ ├── BackplaneMessage.cs │ ├── BackplaneMessageAction.cs │ ├── BackplaneSubscriptionOptions.cs │ └── IFusionCacheBackplane.cs │ ├── CacheKeyModifierMode.cs │ ├── DangerZone │ └── FusionCacheDangerZoneUtils.cs │ ├── Events │ ├── FusionCacheAbstractEventsHub.cs │ ├── FusionCacheBackplaneEventsHub.cs │ ├── FusionCacheBackplaneMessageEventArgs.cs │ ├── FusionCacheCircuitBreakerChangeEventArgs.cs │ ├── FusionCacheCommonEventsHub.cs │ ├── FusionCacheDistributedEventsHub.cs │ ├── FusionCacheEntryEventArgs.cs │ ├── FusionCacheEntryEvictionEventArgs.cs │ ├── FusionCacheEntryHitEventArgs.cs │ ├── FusionCacheEventsHub.cs │ ├── FusionCacheMemoryEventsHub.cs │ └── FusionCacheTagEventArgs.cs │ ├── FusionCache.cs │ ├── FusionCacheBackplaneException.cs │ ├── FusionCacheBuilderExtMethods.cs │ ├── FusionCacheDiagnostics.cs │ ├── FusionCacheDistributedCacheException.cs │ ├── FusionCacheEntryOptions.cs │ ├── FusionCacheExtMethods.cs │ ├── FusionCacheExtMethods_Basic_Async.cs │ ├── FusionCacheExtMethods_Basic_Sync.cs │ ├── FusionCacheExtMethods_FactoryNoCtx_Async.cs │ ├── FusionCacheExtMethods_FactoryNoCtx_Sync.cs │ ├── FusionCacheExtMethods_FactoryWithCtx_Async.cs │ ├── FusionCacheExtMethods_FactoryWithCtx_Sync.cs │ ├── FusionCacheFactoryException.cs │ ├── FusionCacheFactoryExecutionContext.cs │ ├── FusionCacheGlobalDefaults.cs │ ├── FusionCacheInternalStrings.cs │ ├── FusionCacheInvalidOptionsException.cs │ ├── FusionCacheOptions.cs │ ├── FusionCacheSerializationException.cs │ ├── FusionCacheServiceCollectionExtensions.cs │ ├── FusionCache_Async.cs │ ├── FusionCache_Sync.cs │ ├── GlobalAttributes.cs │ ├── GlobalSuppressions.cs │ ├── IFusionCache.cs │ ├── IFusionCacheBuilder.cs │ ├── IFusionCacheProvider.cs │ ├── Internals │ ├── ArrayPoolBufferWriter.cs │ ├── ArrayPoolWritableStream.cs │ ├── AutoRecovery │ │ ├── AutoRecoveryItem.cs │ │ └── AutoRecoveryService.cs │ ├── Backplane │ │ ├── BackplaneAccessor.cs │ │ ├── BackplaneAccessor_Async.cs │ │ └── BackplaneAccessor_Sync.cs │ ├── Builder │ │ └── FusionCacheBuilder.cs │ ├── ConcurrentRandom.cs │ ├── Diagnostics │ │ ├── Activities.cs │ │ ├── CacheLevelKind.cs │ │ ├── Metrics.cs │ │ └── Tags.cs │ ├── Distributed │ │ ├── DistributedCacheAccessor.cs │ │ ├── DistributedCacheAccessor_Async.cs │ │ ├── DistributedCacheAccessor_Sync.cs │ │ └── FusionCacheDistributedEntry.cs │ ├── FusionCacheAction.cs │ ├── FusionCacheEntryMetadata.cs │ ├── FusionCacheInternalUtils.cs │ ├── IFusionCacheEntry.cs │ ├── ImmutableTypeCache.cs │ ├── Memory │ │ ├── FusionCacheMemoryEntry.cs │ │ ├── IFusionCacheMemoryEntry.cs │ │ └── MemoryCacheAccessor.cs │ ├── Provider │ │ ├── FusionCacheProvider.cs │ │ └── LazyNamedCache.cs │ ├── RunUtils.cs │ └── SimpleCircuitBreaker.cs │ ├── Locking │ ├── ExperimentalMemoryLocker.cs │ ├── IFusionCacheMemoryLocker.cs │ ├── ProbabilisticMemoryLocker.cs │ └── StandardMemoryLocker.cs │ ├── MaybeValue.cs │ ├── MicrosoftHybridCache │ └── FusionHybridCache.cs │ ├── NullObjects │ ├── NullBackplane.cs │ ├── NullDistributedCache.cs │ ├── NullFusionCache.cs │ ├── NullMemoryLocker.cs │ ├── NullPlugin.cs │ └── NullSerializer.cs │ ├── Plugins │ └── IFusionCachePlugin.cs │ ├── Serialization │ └── IFusionCacheSerializer.cs │ ├── SyntheticTimeoutException.cs │ ├── ZiggyCreatures.FusionCache.csproj │ ├── artwork │ └── logo-128x128.png │ └── docs │ └── README.md └── tests ├── AOTTester ├── AOTTester.csproj └── Program.cs ├── SerializerPayloadGenerator ├── Program.cs ├── SerializerPayloadGenerator.csproj └── Snapshots │ ├── fusioncachecysharpmemorypackserializer__v0_20_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v0_21_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v0_22_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v0_23_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v0_24_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v0_25_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v0_26_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v1_0_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v1_1_0_0.bin │ ├── fusioncachecysharpmemorypackserializer__v1_2_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v0_20_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v0_21_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v0_22_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v0_23_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v0_24_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v0_25_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v0_26_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v1_0_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v1_1_0_0.bin │ ├── fusioncacheneueccmessagepackserializer__v1_2_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v0_20_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v0_21_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v0_22_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v0_23_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v0_24_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v0_25_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v0_26_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v1_0_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v1_1_0_0.bin │ ├── fusioncachenewtonsoftjsonserializer__v1_2_0_0.bin │ ├── fusioncacheprotobufnetserializer__v0_20_0_0.bin │ ├── fusioncacheprotobufnetserializer__v0_21_0_0.bin │ ├── fusioncacheprotobufnetserializer__v0_22_0_0.bin │ ├── fusioncacheprotobufnetserializer__v0_23_0_0.bin │ ├── fusioncacheprotobufnetserializer__v0_24_0_0.bin │ ├── fusioncacheprotobufnetserializer__v0_25_0_0.bin │ ├── fusioncacheprotobufnetserializer__v0_26_0_0.bin │ ├── fusioncacheprotobufnetserializer__v1_0_0_0.bin │ ├── fusioncacheprotobufnetserializer__v1_1_0_0.bin │ ├── fusioncacheprotobufnetserializer__v1_2_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v0_20_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v0_21_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v0_22_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v0_23_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v0_24_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v0_25_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v0_26_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v1_0_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v1_1_0_0.bin │ ├── fusioncacheservicestackjsonserializer__v1_2_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v0_20_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v0_21_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v0_22_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v0_23_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v0_24_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v0_25_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v0_26_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v1_0_0_0.bin │ ├── fusioncachesystemtextjsonserializer__v1_1_0_0.bin │ └── fusioncachesystemtextjsonserializer__v1_2_0_0.bin ├── WebAppTest ├── Controllers │ └── MvcController.cs ├── Program.cs ├── Properties │ └── launchSettings.json ├── WebAppTest.csproj ├── WebAppTest.http ├── appsettings.Development.json └── appsettings.json ├── ZiggyCreatures.FusionCache.Playground ├── GlobalSuppressions.cs ├── Program.cs ├── Scenarios │ ├── LoggingScenario.cs │ ├── OpenTelemetryScenario.cs │ └── ScratchpadScenario.cs └── ZiggyCreatures.FusionCache.Playground.csproj ├── ZiggyCreatures.FusionCache.Simulator ├── Program.cs ├── Stuff │ ├── BackplaneType.cs │ ├── DistributedCacheType.cs │ ├── SimulatedCluster.cs │ ├── SimulatedDatabase.cs │ └── SimulatedNode.cs └── ZiggyCreatures.FusionCache.Simulator.csproj └── ZiggyCreatures.FusionCache.Tests ├── AutoRecoveryTests.cs ├── AutoRecoveryTests_Async.cs ├── AutoRecoveryTests_Sync.cs ├── CacheStampedeTests.cs ├── DependencyInjectionTests.cs ├── EventsTests.cs ├── EventsTests_Async.cs ├── EventsTests_Sync.cs ├── FusionHybridCacheTests ├── HybridL1L2Tests.cs └── HybridL1Tests.cs ├── GeneralTests.cs ├── GeneralTests_Async.cs ├── GeneralTests_Sync.cs ├── GlobalSuppressions.cs ├── L1BackplaneTests.cs ├── L1BackplaneTests_Async.cs ├── L1BackplaneTests_Sync.cs ├── L1L2BackplaneTests.cs ├── L1L2BackplaneTests_Async.cs ├── L1L2BackplaneTests_Sync.cs ├── L1L2Tests.cs ├── L1L2Tests_Async.cs ├── L1L2Tests_Sync.cs ├── L1Tests.cs ├── L1Tests_Async.cs ├── L1Tests_Sync.cs ├── LoggingTests.cs ├── OtherLibs ├── CacheStampedeTests_CacheManager.cs ├── CacheStampedeTests_CacheTower.cs ├── CacheStampedeTests_EasyCaching.cs ├── CacheStampedeTests_HybridCache.cs └── CacheStampedeTests_LazyCache.cs ├── Overloads ├── OverloadsCallsTryouts.cs ├── OverloadsCallsTryouts_Async.cs └── OverloadsCallsTryouts_Sync.cs ├── PluginsTests.cs ├── PluginsTests_Async.cs ├── PluginsTests_Sync.cs ├── RunUtilsTests.cs ├── RunUtilsTests_Async.cs ├── RunUtilsTests_Sync.cs ├── SerializationTests.cs ├── SerializationTests_Async.cs ├── SerializationTests_Sync.cs ├── Snapshots ├── fusioncachecysharpmemorypackserializer__v0_20_0_0.bin ├── fusioncachecysharpmemorypackserializer__v0_21_0_0.bin ├── fusioncachecysharpmemorypackserializer__v0_22_0_0.bin ├── fusioncachecysharpmemorypackserializer__v0_23_0_0.bin ├── fusioncachecysharpmemorypackserializer__v0_24_0_0.bin ├── fusioncachecysharpmemorypackserializer__v0_25_0_0.bin ├── fusioncachecysharpmemorypackserializer__v0_26_0_0.bin ├── fusioncachecysharpmemorypackserializer__v1_0_0_0.bin ├── fusioncachecysharpmemorypackserializer__v1_1_0_0.bin ├── fusioncachecysharpmemorypackserializer__v1_2_0_0.bin ├── fusioncacheneueccmessagepackserializer__v0_20_0_0.bin ├── fusioncacheneueccmessagepackserializer__v0_21_0_0.bin ├── fusioncacheneueccmessagepackserializer__v0_22_0_0.bin ├── fusioncacheneueccmessagepackserializer__v0_23_0_0.bin ├── fusioncacheneueccmessagepackserializer__v0_24_0_0.bin ├── fusioncacheneueccmessagepackserializer__v0_25_0_0.bin ├── fusioncacheneueccmessagepackserializer__v0_26_0_0.bin ├── fusioncacheneueccmessagepackserializer__v1_0_0_0.bin ├── fusioncacheneueccmessagepackserializer__v1_1_0_0.bin ├── fusioncacheneueccmessagepackserializer__v1_2_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v0_20_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v0_21_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v0_22_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v0_23_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v0_24_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v0_25_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v0_26_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v1_0_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v1_1_0_0.bin ├── fusioncachenewtonsoftjsonserializer__v1_2_0_0.bin ├── fusioncacheprotobufnetserializer__v0_20_0_0.bin ├── fusioncacheprotobufnetserializer__v0_21_0_0.bin ├── fusioncacheprotobufnetserializer__v0_22_0_0.bin ├── fusioncacheprotobufnetserializer__v0_23_0_0.bin ├── fusioncacheprotobufnetserializer__v0_24_0_0.bin ├── fusioncacheprotobufnetserializer__v0_25_0_0.bin ├── fusioncacheprotobufnetserializer__v0_26_0_0.bin ├── fusioncacheprotobufnetserializer__v1_0_0_0.bin ├── fusioncacheprotobufnetserializer__v1_1_0_0.bin ├── fusioncacheprotobufnetserializer__v1_2_0_0.bin ├── fusioncacheservicestackjsonserializer__v0_20_0_0.bin ├── fusioncacheservicestackjsonserializer__v0_21_0_0.bin ├── fusioncacheservicestackjsonserializer__v0_22_0_0.bin ├── fusioncacheservicestackjsonserializer__v0_23_0_0.bin ├── fusioncacheservicestackjsonserializer__v0_24_0_0.bin ├── fusioncacheservicestackjsonserializer__v0_25_0_0.bin ├── fusioncacheservicestackjsonserializer__v0_26_0_0.bin ├── fusioncacheservicestackjsonserializer__v1_0_0_0.bin ├── fusioncacheservicestackjsonserializer__v1_1_0_0.bin ├── fusioncacheservicestackjsonserializer__v1_2_0_0.bin ├── fusioncachesystemtextjsonserializer__v0_20_0_0.bin ├── fusioncachesystemtextjsonserializer__v0_21_0_0.bin ├── fusioncachesystemtextjsonserializer__v0_22_0_0.bin ├── fusioncachesystemtextjsonserializer__v0_23_0_0.bin ├── fusioncachesystemtextjsonserializer__v0_24_0_0.bin ├── fusioncachesystemtextjsonserializer__v0_25_0_0.bin ├── fusioncachesystemtextjsonserializer__v0_26_0_0.bin ├── fusioncachesystemtextjsonserializer__v1_0_0_0.bin ├── fusioncachesystemtextjsonserializer__v1_1_0_0.bin └── fusioncachesystemtextjsonserializer__v1_2_0_0.bin ├── Stuff ├── AbstractTests.cs ├── CacheStampedeClassData.cs ├── ComplexType.cs ├── EntryActionKind.cs ├── EntryActionsStats.cs ├── FakeHttpEndpoint.cs ├── FakeHttpResponse.cs ├── LimitedCharsBackplane.cs ├── LimitedCharsDistributedCache.cs ├── ListLogger.cs ├── MemoryLockerType.cs ├── MemoryLockerTypesClassData.cs ├── SerializerType.cs ├── SerializerTypesClassData.cs ├── SimpleDisposable.cs ├── SimpleEventsPlugin.cs ├── SimpleImmutableObject.cs ├── SimpleMemoryLocker.cs ├── SimplePlugin.cs ├── SimpleServiceKey.cs ├── SimpleServiceWithKeyedDependency.cs ├── SyncOnlySerializer.cs ├── TestsUtils.cs ├── UnreachableException.cs └── XUnitLogger.cs └── ZiggyCreatures.FusionCache.Tests.csproj /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG] " 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Describe the bug 11 | A clear and concise description of what the bug is. 12 | 13 | ## To Reproduce 14 | Here's a [MRE (Minimal Reproducible Example)](https://en.wikipedia.org/wiki/Minimal_reproducible_example) of the issue: 15 | - code sample block 16 | - or gist 17 | - or a repo 18 | - etc 19 | 20 | 23 | 24 | ## Expected behavior 25 | A clear and concise description of what you expected to happen. 26 | 27 | ## Versions 28 | I've encountered this issue on: 29 | - FusionCache version 30 | - .NET version 31 | - OS version 32 | - others (eg: if applicable, the Redis/Memcached/etc version and if onprem/cloud/etc) 33 | 34 | ## Screenshots 35 | If applicable, add screenshots to help explain your problem. 36 | 37 | ## Additional context 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE] " 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Problem 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | ## Solution 14 | A clear and concise description of what you want to happen. 15 | 16 | ## Alternatives 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | ## Additional context 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Build and test 2 | on: 3 | pull_request: 4 | workflow_dispatch: 5 | env: 6 | DOTNET_NOLOGO: true 7 | TEST_RESULTS: artifacts/tests 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@master 13 | - name: Set up .NET Core 14 | uses: actions/setup-dotnet@v4 15 | with: 16 | dotnet-version: '9.0.x' 17 | 18 | - run: dotnet --info 19 | - name: Build solution and run all tests 20 | run: dotnet test --verbosity normal -l trx --results-directory '${{ env.TEST_RESULTS }}' 21 | 22 | - name: Publish test results 23 | uses: EnricoMi/publish-unit-test-result-action/linux@v2 24 | if: ${{ success() || failure() }} 25 | with: 26 | files: '${{ env.TEST_RESULTS }}/*.trx' 27 | check_name: "Test results" 28 | report_individual_runs: true 29 | action_fail: true 30 | time_unit: milliseconds 31 | #ignore_runs: true 32 | compare_to_earlier_commit: false 33 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Jody Donetti 5 | Jody Donetti 6 | FusionCache 7 | Copyright © Jody Donetti 8 | MIT 9 | true 10 | 11 | git 12 | https://github.com/ZiggyCreatures/FusionCache 13 | https://github.com/ZiggyCreatures/FusionCache 14 | 15 | true 16 | true 17 | embedded 18 | 22 | latest 23 | enable 24 | logo-128x128.png 25 | README.md 26 | 27 | true 28 | 29 | enable 30 | 31 | 32 | 33 | 34 | true 35 | 36 | 37 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | ### MIT License 2 | 3 | Copyright (c) 2020-2025 Jody Donetti 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /benchmarks/ZiggyCreatures.FusionCache.Benchmarks/ExecutionBenchmarkAsync.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Attributes; 2 | using BenchmarkDotNet.Columns; 3 | using BenchmarkDotNet.Configs; 4 | using BenchmarkDotNet.Diagnosers; 5 | using BenchmarkDotNet.Jobs; 6 | using BenchmarkDotNet.Toolchains.InProcess.Emit; 7 | using ZiggyCreatures.Caching.Fusion.Internals; 8 | 9 | namespace ZiggyCreatures.Caching.Fusion.Benchmarks; 10 | 11 | [MemoryDiagnoser] 12 | [Config(typeof(Config))] 13 | public class ExecutionBenchmarkAsync 14 | { 15 | private class Config : ManualConfig 16 | { 17 | public Config() 18 | { 19 | AddColumn(StatisticColumn.P95); 20 | AddDiagnoser(MemoryDiagnoser.Default); 21 | //AddLogicalGroupRules(BenchmarkLogicalGroupRule.ByMethod); 22 | AddJob(Job.Default.WithToolchain(InProcessEmitToolchain.Instance)); 23 | //WithOrderer(new DefaultOrderer(summaryOrderPolicy: SummaryOrderPolicy.FastestToSlowest)); 24 | WithSummaryStyle(BenchmarkDotNet.Reports.SummaryStyle.Default.WithMaxParameterColumnWidth(50)); 25 | } 26 | } 27 | 28 | private async Task ExecutorAsync() 29 | { 30 | for (int i = 0; i < 1_000_000_000; i++) 31 | { 32 | i++; 33 | } 34 | } 35 | 36 | [Benchmark(Baseline = true)] 37 | public async Task WithTimeout() 38 | { 39 | await RunUtils.RunAsyncActionAdvancedAsync( 40 | async _ => await ExecutorAsync(), 41 | TimeSpan.FromSeconds(2), 42 | false, 43 | true 44 | ); 45 | } 46 | 47 | [Benchmark] 48 | public async Task WithTimeout2() 49 | { 50 | await RunUtils.RunAsyncActionAdvancedAsync( 51 | async _ => await ExecutorAsync(), 52 | TimeSpan.FromSeconds(2), 53 | true, 54 | true 55 | ); 56 | } 57 | 58 | [Benchmark] 59 | public async Task WithoutTimeout() 60 | { 61 | await RunUtils.RunAsyncActionAdvancedAsync( 62 | async _ => await ExecutorAsync(), 63 | Timeout.InfiniteTimeSpan, 64 | true, 65 | true 66 | ); 67 | } 68 | 69 | [Benchmark] 70 | public async Task Raw() 71 | { 72 | await ExecutorAsync(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /benchmarks/ZiggyCreatures.FusionCache.Benchmarks/ExecutionBenchmarkSync.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Attributes; 2 | using BenchmarkDotNet.Columns; 3 | using BenchmarkDotNet.Configs; 4 | using BenchmarkDotNet.Diagnosers; 5 | using BenchmarkDotNet.Jobs; 6 | using BenchmarkDotNet.Toolchains.InProcess.Emit; 7 | using ZiggyCreatures.Caching.Fusion.Internals; 8 | 9 | namespace ZiggyCreatures.Caching.Fusion.Benchmarks; 10 | 11 | [MemoryDiagnoser] 12 | [Config(typeof(Config))] 13 | public class ExecutionBenchmarkSync 14 | { 15 | private class Config : ManualConfig 16 | { 17 | public Config() 18 | { 19 | AddColumn(StatisticColumn.P95); 20 | AddDiagnoser(MemoryDiagnoser.Default); 21 | //AddLogicalGroupRules(BenchmarkLogicalGroupRule.ByMethod); 22 | AddJob(Job.Default.WithToolchain(InProcessEmitToolchain.Instance)); 23 | //WithOrderer(new DefaultOrderer(summaryOrderPolicy: SummaryOrderPolicy.FastestToSlowest)); 24 | WithSummaryStyle(BenchmarkDotNet.Reports.SummaryStyle.Default.WithMaxParameterColumnWidth(50)); 25 | } 26 | } 27 | 28 | private void Executor() 29 | { 30 | for (int i = 0; i < 1_000_000_000; i++) 31 | { 32 | i++; 33 | } 34 | } 35 | 36 | [Benchmark(Baseline = true)] 37 | public void WithTimeout() 38 | { 39 | RunUtils.RunSyncActionAdvanced( 40 | _ => Executor(), 41 | TimeSpan.FromSeconds(2), 42 | false, 43 | true 44 | ); 45 | } 46 | 47 | [Benchmark] 48 | public void WithTimeout2() 49 | { 50 | RunUtils.RunSyncActionAdvanced( 51 | _ => Executor(), 52 | TimeSpan.FromSeconds(2), 53 | true, 54 | true 55 | ); 56 | } 57 | 58 | [Benchmark] 59 | public void WithoutTimeout() 60 | { 61 | RunUtils.RunSyncActionAdvanced( 62 | _ => Executor(), 63 | Timeout.InfiniteTimeSpan, 64 | true, 65 | true 66 | ); 67 | } 68 | 69 | [Benchmark] 70 | public void Raw() 71 | { 72 | Executor(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /benchmarks/ZiggyCreatures.FusionCache.Benchmarks/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Performance", "HAA0101:Array allocation for params parameter", Justification = "")] 9 | [assembly: SuppressMessage("Performance", "HAA0301:Closure Allocation Source", Justification = "")] 10 | [assembly: SuppressMessage("Performance", "HAA0302:Display class allocation to capture closure", Justification = "")] 11 | -------------------------------------------------------------------------------- /benchmarks/ZiggyCreatures.FusionCache.Benchmarks/Program.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Running; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Benchmarks; 4 | 5 | class Program 6 | { 7 | public static async Task Main(string[] args) 8 | { 9 | BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /benchmarks/ZiggyCreatures.FusionCache.Benchmarks/SamplePayload.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Benchmarks; 2 | 3 | public class SamplePayload : IEquatable 4 | { 5 | public SamplePayload() 6 | { 7 | Foo = "foo"; 8 | Bar = "bar"; 9 | Baz = 42; 10 | } 11 | 12 | public string Foo { get; set; } 13 | public string Bar { get; set; } 14 | public int Baz { get; set; } 15 | 16 | public override bool Equals(object? obj) 17 | { 18 | return Equals(obj as SamplePayload); 19 | } 20 | 21 | public bool Equals(SamplePayload? other) 22 | { 23 | return other is not null && 24 | Foo == other.Foo && 25 | Bar == other.Bar && 26 | Baz == other.Baz; 27 | } 28 | 29 | public override int GetHashCode() 30 | { 31 | return HashCode.Combine(Foo, Bar, Baz); 32 | } 33 | 34 | public static bool operator ==(SamplePayload? left, SamplePayload? right) 35 | { 36 | return EqualityComparer.Default.Equals(left, right); 37 | } 38 | 39 | public static bool operator !=(SamplePayload? left, SamplePayload? right) 40 | { 41 | return !(left == right); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /docs/FactoryOptimization.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | ![FusionCache logo](logo-128x128.png) 4 | 5 |
6 | 7 | # 🛡️ Cache Stampede protection 8 | 9 | This content has been moved to the [CacheStampede](CacheStampede.md) page. -------------------------------------------------------------------------------- /docs/Update_v1_0_0.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | ![FusionCache logo](logo-128x128.png) 4 | 5 |
6 | 7 | # 🆙 Update to v1.0.0 8 | 9 | If you are updating to `v1.0` from a previous version, in general everything should be fine. 10 | 11 | But, in some niche and specific cases, you may have to look out for some minor details or deprecations. 12 | 13 | The 2 minor (but still technically breaking) changes are: 14 | - slightly changed the nullability annotations with generics for the return values in the `GetOrSet` and `GetOrSetAsync` 15 | - the `FusionCacheEntryOptions.Size` option went from being `long` to `long?` 16 | 17 | Historically there have been only 2 versions that needed some attention, so please read the update notes if you are updating from a previous version: 18 | 19 | - to update from a version before `v0.20.0` ([update notes](Update_v0_20_0.md)) 20 | - to update from a version before `v0.24.0` ([update notes](Update_v0_24_0.md)) 21 | 22 | Apart from these everything should be quite smooth. 23 | 24 | In case something has been deprecated with time, there will be some warnings at compile time thanks to the usage of the `[Obsolete]` attribute along with useful instructions to follow, what to change, etc. 25 | 26 | That's all, happy updating! -------------------------------------------------------------------------------- /docs/google-award-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/google-award-128x128.png -------------------------------------------------------------------------------- /docs/google-award-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/google-award-256x256.png -------------------------------------------------------------------------------- /docs/images/background-distributed-operations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/background-distributed-operations.png -------------------------------------------------------------------------------- /docs/images/cache-stampede-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/cache-stampede-after.png -------------------------------------------------------------------------------- /docs/images/cache-stampede-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/cache-stampede-before.png -------------------------------------------------------------------------------- /docs/images/cold-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/cold-start.png -------------------------------------------------------------------------------- /docs/images/crinkle-crankle-wall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/crinkle-crankle-wall.jpg -------------------------------------------------------------------------------- /docs/images/diagram-extended.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/diagram-extended.png -------------------------------------------------------------------------------- /docs/images/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/diagram.png -------------------------------------------------------------------------------- /docs/images/diagrams.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/diagrams.png -------------------------------------------------------------------------------- /docs/images/factory-optimization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/factory-optimization.png -------------------------------------------------------------------------------- /docs/images/fail-safe-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/fail-safe-after.png -------------------------------------------------------------------------------- /docs/images/fail-safe-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/fail-safe-before.png -------------------------------------------------------------------------------- /docs/images/fusioncache-simulator-autorecovery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/fusioncache-simulator-autorecovery.png -------------------------------------------------------------------------------- /docs/images/horizontal-scalability.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/horizontal-scalability.png -------------------------------------------------------------------------------- /docs/images/opentelemetry-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/opentelemetry-example.png -------------------------------------------------------------------------------- /docs/images/redis-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/redis-logo.png -------------------------------------------------------------------------------- /docs/images/stepbystep-00-database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-00-database.png -------------------------------------------------------------------------------- /docs/images/stepbystep-00-nocache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-00-nocache.png -------------------------------------------------------------------------------- /docs/images/stepbystep-01-memorycache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-01-memorycache.png -------------------------------------------------------------------------------- /docs/images/stepbystep-02-fusioncache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-02-fusioncache.png -------------------------------------------------------------------------------- /docs/images/stepbystep-03-failsafe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-03-failsafe.png -------------------------------------------------------------------------------- /docs/images/stepbystep-04-factorytimeouts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-04-factorytimeouts.png -------------------------------------------------------------------------------- /docs/images/stepbystep-05-distributedcache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-05-distributedcache.png -------------------------------------------------------------------------------- /docs/images/stepbystep-06-distributedoptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-06-distributedoptions.png -------------------------------------------------------------------------------- /docs/images/stepbystep-07-backplane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-07-backplane.png -------------------------------------------------------------------------------- /docs/images/stepbystep-intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/stepbystep-intro.png -------------------------------------------------------------------------------- /docs/images/talk-on-dotnet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talk-on-dotnet.jpg -------------------------------------------------------------------------------- /docs/images/talks/continuous-delivery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/continuous-delivery.jpg -------------------------------------------------------------------------------- /docs/images/talks/data-exposed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/data-exposed.jpg -------------------------------------------------------------------------------- /docs/images/talks/dotnet-podcast.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/dotnet-podcast.jpg -------------------------------------------------------------------------------- /docs/images/talks/dotnetconf-italia.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/dotnetconf-italia.jpg -------------------------------------------------------------------------------- /docs/images/talks/live-coding-alla-scoperta-di-fusioncache.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/live-coding-alla-scoperta-di-fusioncache.jpg -------------------------------------------------------------------------------- /docs/images/talks/on-dotnet-2025.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/on-dotnet-2025.jpg -------------------------------------------------------------------------------- /docs/images/talks/on-dotnet-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/on-dotnet-small.jpg -------------------------------------------------------------------------------- /docs/images/talks/on-dotnet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/on-dotnet.jpg -------------------------------------------------------------------------------- /docs/images/talks/open-at-microsoft.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/open-at-microsoft.jpg -------------------------------------------------------------------------------- /docs/images/talks/small-talks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/small-talks.jpg -------------------------------------------------------------------------------- /docs/images/talks/spike-time.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/talks/spike-time.jpg -------------------------------------------------------------------------------- /docs/images/timeouts-timeline-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/timeouts-timeline-background.png -------------------------------------------------------------------------------- /docs/images/timeouts-timeline-blocking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/images/timeouts-timeline-blocking.png -------------------------------------------------------------------------------- /docs/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/logo-128x128.png -------------------------------------------------------------------------------- /docs/logo-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/logo-256x256.png -------------------------------------------------------------------------------- /docs/logo-400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/logo-400x400.png -------------------------------------------------------------------------------- /docs/logo-plugin-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/logo-plugin-128x128.png -------------------------------------------------------------------------------- /docs/logo-plugin-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/logo-plugin-256x256.png -------------------------------------------------------------------------------- /docs/logo-plugin-400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/logo-plugin-400x400.png -------------------------------------------------------------------------------- /docs/mvp-award-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/docs/mvp-award-128x128.png -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.102", 4 | "allowPrerelease": true, 5 | "rollForward": "latestFeature" 6 | } 7 | } -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.AspNetCore.OutputCaching/FusionOutputCacheOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.AspNetCore.OutputCaching; 4 | 5 | /// 6 | /// Options for configuring OutputCache with FusionCache. 7 | /// 8 | [DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")] 9 | public class FusionOutputCacheOptions 10 | { 11 | /// 12 | /// The name of the cache to use for output caching: if left to , the default cache (with a name equal to ) will be used. 13 | /// 14 | public string? CacheName { get; set; } 15 | 16 | private string GetDebuggerDisplay() 17 | { 18 | return $"OutputCache Name={CacheName}"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.AspNetCore.OutputCaching/FusionOutputCacheStore.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.OutputCaching; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.AspNetCore.OutputCaching; 4 | 5 | internal sealed class FusionOutputCacheStore : IOutputCacheStore 6 | { 7 | private readonly IFusionCache _cache; 8 | 9 | public FusionOutputCacheStore(IFusionCache cache) 10 | { 11 | ArgumentNullException.ThrowIfNull(cache, nameof(cache)); 12 | 13 | _cache = cache; 14 | } 15 | 16 | /// 17 | public async ValueTask EvictByTagAsync(string tag, CancellationToken cancellationToken) 18 | { 19 | await _cache.RemoveByTagAsync(tag, token: cancellationToken); 20 | } 21 | 22 | /// 23 | public async ValueTask GetAsync(string key, CancellationToken cancellationToken) 24 | { 25 | return await _cache.GetOrDefaultAsync(key, null, token: cancellationToken); 26 | } 27 | 28 | /// 29 | public async ValueTask SetAsync(string key, byte[] value, string[]? tags, TimeSpan validFor, CancellationToken cancellationToken) 30 | { 31 | await _cache.SetAsync(key, value, options => options.SetDuration(validFor).SetSize(value.Length), tags, token: cancellationToken); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.AspNetCore.OutputCaching/ZiggyCreatures.FusionCache.AspNetCore.OutputCaching.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0;net8.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.AspNetCore.OutputCaching 7 | ASP.NET Output Cache based on FusionCache 8 | aspnet;outputcache;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.AspNetCore.OutputCaching 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.AspNetCore.OutputCaching/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.AspNetCore.OutputCaching/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.AspNetCore.OutputCaching/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package contains the ASP.NET [Output Cache](https://learn.microsoft.com/en-us/aspnet/core/performance/caching/output) implementation for FusionCache. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.Memory/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Simplification", "RCS1049:Simplify boolean comparison.")] 9 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.Memory/MemoryBackplaneOptions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Options; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Backplane.Memory; 4 | 5 | /// 6 | /// Represents the options available for the memory backplane. 7 | /// 8 | public class MemoryBackplaneOptions 9 | : IOptions 10 | { 11 | /// 12 | /// The logical id used to simulate a connection to a server. 13 | ///
14 | /// It is used to group together multiple instances of a MemoryBackplane and separate them from others, without interfering with other backplanes running concurrently at the same time (mostly useful for testing). 15 | ///
16 | /// Basically it's like a connection string. 17 | ///
18 | public string? ConnectionId { get; set; } 19 | 20 | MemoryBackplaneOptions IOptions.Value 21 | { 22 | get { return this; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.Memory/ZiggyCreatures.FusionCache.Backplane.Memory.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Backplane.Memory 7 | FusionCache in memory backplane, used for testing 8 | backplane;memory;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.Backplane.Memory 10 | true 11 | 12 | - Change: better async support for subscribe/unsubscribe/publish 13 | - Update: package dependencies 14 | 15 | 1.0.0 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.Memory/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Backplane.Memory/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.Memory/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is an in-memory backplane implementation, eg: useful for testing. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Simplification", "RCS1049:Simplify boolean comparison.", Justification = "")] 9 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis/RedisBackplaneOptions.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Microsoft.Extensions.Options; 3 | using StackExchange.Redis; 4 | 5 | namespace ZiggyCreatures.Caching.Fusion.Backplane.StackExchangeRedis; 6 | 7 | /// 8 | /// Represents the options available for the Redis backplane. 9 | /// 10 | public class RedisBackplaneOptions 11 | : IOptions 12 | { 13 | /// 14 | /// The configuration used to connect to Redis. 15 | /// 16 | public string? Configuration { get; set; } 17 | 18 | /// 19 | /// The configuration used to connect to Redis. 20 | /// This is preferred over Configuration. 21 | /// 22 | public ConfigurationOptions? ConfigurationOptions { get; set; } 23 | 24 | /// 25 | /// A delegate to create the ConnectionMultiplexer instance. 26 | /// 27 | public Func>? ConnectionMultiplexerFactory { get; set; } 28 | 29 | /// 30 | /// DEPRECATED: verify that at least one client received the notifications after each publish. 31 | /// 32 | [EditorBrowsable(EditorBrowsableState.Never)] 33 | [Obsolete("Please stop using this, it is now obsolete.", true)] 34 | public bool VerifyReceivedClientsCountAfterPublish { get; set; } = false; 35 | 36 | RedisBackplaneOptions IOptions.Value 37 | { 38 | get { return this; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis/ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0;net8.0;net9.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis 7 | FusionCache backplane for Redis based on the StackExchange.Redis library 8 | backplane;redis;stackexchange;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.Backplane.StackExchangeRedis 10 | true 11 | 12 | - Change: better async support for subscribe/unsubscribe/publish 13 | - Update: package dependencies 14 | 15 | 1.0.0 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is a backplane implementation on [Redis](https://redis.io/) based on the awesome [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis) library. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Chaos/ChaosException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Chaos; 4 | 5 | /// 6 | /// The exception that is thrown when a method call should fail because of a randomized chaos event. 7 | /// 8 | [Serializable] 9 | public class ChaosException 10 | : InvalidOperationException 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public ChaosException() 16 | { 17 | } 18 | 19 | /// Initializes a new instance of the class with a specified error message. 20 | /// The message that describes the error. 21 | public ChaosException(string? message) 22 | : base(message) 23 | { 24 | } 25 | 26 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 27 | /// The error message that explains the reason for the exception. 28 | /// The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. 29 | public ChaosException(string? message, Exception? innerException) 30 | : base(message, innerException) 31 | { 32 | } 33 | 34 | /// Initializes a new instance of the class with serialized data. 35 | /// The object that holds the serialized object data. 36 | /// The contextual information about the source or destination. 37 | protected ChaosException(SerializationInfo info, StreamingContext context) 38 | : base(info, context) 39 | { 40 | } 41 | } -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Chaos/ChaosMemoryCache.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Caching.Memory; 2 | using Microsoft.Extensions.Logging; 3 | using ZiggyCreatures.Caching.Fusion.Chaos.Internals; 4 | 5 | namespace ZiggyCreatures.Caching.Fusion.Chaos; 6 | 7 | /// 8 | /// An implementation of that acts on behalf of another one, but with a (controllable) amount of chaos in-between. 9 | /// 10 | public class ChaosMemoryCache 11 | : AbstractChaosComponent 12 | , IMemoryCache 13 | { 14 | private readonly IMemoryCache _innerCache; 15 | 16 | /// 17 | /// Initializes a new instance of the ChaosMemoryCache class. 18 | /// 19 | /// The actual used if and when chaos does not happen. 20 | /// The logger to use, or . 21 | public ChaosMemoryCache(IMemoryCache innerCache, ILogger? logger = null) 22 | : base(logger) 23 | { 24 | _innerCache = innerCache ?? throw new ArgumentNullException(nameof(innerCache)); 25 | } 26 | 27 | /// 28 | public ICacheEntry CreateEntry(object key) 29 | { 30 | MaybeChaos(); 31 | return _innerCache.CreateEntry(key); 32 | } 33 | 34 | /// 35 | public void Dispose() 36 | { 37 | // EMPTY 38 | } 39 | 40 | /// 41 | public void Remove(object key) 42 | { 43 | MaybeChaos(); 44 | _innerCache.Remove(key); 45 | } 46 | 47 | /// 48 | public bool TryGetValue(object key, out object? value) 49 | { 50 | MaybeChaos(); 51 | return _innerCache.TryGetValue(key, out value); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Chaos/ChaosPlugin.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using ZiggyCreatures.Caching.Fusion.Chaos.Internals; 3 | using ZiggyCreatures.Caching.Fusion.Plugins; 4 | 5 | namespace ZiggyCreatures.Caching.Fusion.Chaos; 6 | 7 | /// 8 | /// An implementation of with a (controllable) amount of chaos in-between. 9 | /// 10 | public class ChaosPlugin 11 | : AbstractChaosComponent 12 | , IFusionCachePlugin 13 | { 14 | private readonly IFusionCachePlugin _innerPlugin; 15 | 16 | /// 17 | /// Initializes a new instance of the ChaosPlugin class. 18 | /// 19 | /// The actual used if and when chaos does not happen. 20 | /// The logger to use, or . 21 | public ChaosPlugin(IFusionCachePlugin innerPlugin, ILogger? logger = null) 22 | : base(logger) 23 | { 24 | _innerPlugin = innerPlugin ?? throw new ArgumentNullException(nameof(innerPlugin)); 25 | } 26 | 27 | /// 28 | public void Start(IFusionCache cache) 29 | { 30 | MaybeChaos(); 31 | _innerPlugin.Start(cache); 32 | } 33 | 34 | /// 35 | public void Stop(IFusionCache cache) 36 | { 37 | MaybeChaos(); 38 | _innerPlugin.Stop(cache); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Chaos/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Style", "IDE0290:Use primary constructor")] 9 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Chaos/ZiggyCreatures.FusionCache.Chaos.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Chaos 7 | Chaos-related utilities and implementations of various componenets (like a distributed cache or a backplane), useful for things like testing dependent components' behavior in a controlled failing environment. 8 | chaos;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.Chaos 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Chaos/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Chaos/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Chaos/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package contains [chaos-related](https://en.wikipedia.org/wiki/Chaos_engineering) utilities and implementations of various componenets (like a distributed cache or a backplane), useful for things like testing dependent components' behavior in a controlled failing environment. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Locking.AsyncKeyed/ZiggyCreatures.FusionCache.Locking.AsyncKeyed.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0;net8.0;net9.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Locking.AsyncKeyed 7 | FusionCache memory locker based on the AsyncKeyedLock library 8 | memory-locker;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.Locking.AsyncKeyed 10 | true 11 | 12 | - Initial release 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Locking.AsyncKeyed/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Locking.AsyncKeyed/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Locking.AsyncKeyed/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package contains a memory locker implementation based on the [AsyncKeyedLock](https://github.com/MarkCiliaVincenti/AsyncKeyedLock) library. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.MicrosoftHybridCache/ZiggyCreatures.FusionCache.MicrosoftHybridCache.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.0.0-preview-4 6 | ZiggyCreatures.FusionCache.MicrosoftHybridCache 7 | An implementation of Microsoft's HybridCache based on FusionCache, for when you need to depend on the Microsoft abstraction, but want the power of FusionCache 8 | caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.MicrosoftHybridCache 10 | true 11 | 12 | - Deprecation: this package is now empty: all related code moved to the main FusionCache package 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.MicrosoftHybridCache/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.MicrosoftHybridCache/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.MicrosoftHybridCache/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | ⚠️ IMPORTANT: this package has been deprecated since the related code has been moved into the main FusionCache package. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.OpenTelemetry/FusionCacheMetricsInstrumentationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.OpenTelemetry; 2 | 3 | /// 4 | /// Represents the options available for the metrics instrumentation of FusionCache. 5 | /// 6 | public class FusionCacheMetricsInstrumentationOptions 7 | { 8 | /// 9 | /// Include metrics for the memory level. (default: ) 10 | /// 11 | public bool IncludeMemoryLevel { get; set; } = false; 12 | 13 | /// 14 | /// Include metrics for the distributed level. (default: ) 15 | /// 16 | public bool IncludeDistributedLevel { get; set; } = false; 17 | 18 | /// 19 | /// Include metrics for the backplane. (default: ) 20 | /// 21 | public bool IncludeBackplane { get; set; } = false; 22 | } 23 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.OpenTelemetry/FusionCacheTracesInstrumentationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.OpenTelemetry; 2 | 3 | /// 4 | /// Represents the options available for the traces instrumentation of FusionCache. 5 | /// 6 | public class FusionCacheTracesInstrumentationOptions 7 | { 8 | /// 9 | /// Include traces for the memory level. (default: ) 10 | /// 11 | public bool IncludeMemoryLevel { get; set; } = false; 12 | 13 | /// 14 | /// Include traces for the distributed level. (default: ) 15 | /// 16 | public bool IncludeDistributedLevel { get; set; } = true; 17 | 18 | /// 19 | /// Include traces for the backplane. (default: ) 20 | /// 21 | public bool IncludeBackplane { get; set; } = false; 22 | } 23 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.OpenTelemetry/MeterProviderBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion; 2 | using ZiggyCreatures.Caching.Fusion.OpenTelemetry; 3 | 4 | namespace OpenTelemetry.Metrics; 5 | 6 | /// 7 | /// Contains extension methods to for enabling FusionCache metrics instrumentation. 8 | /// 9 | public static class MeterProviderBuilderExtensions 10 | { 11 | /// 12 | /// Enable metrics instrumentation for FusionCache. 13 | /// 14 | /// being configured. 15 | /// Callback action for configuring the available options. 16 | /// The instance of to chain the calls. 17 | public static MeterProviderBuilder AddFusionCacheInstrumentation(this MeterProviderBuilder builder, Action? configure = null) 18 | { 19 | if (builder is null) 20 | throw new ArgumentNullException(nameof(builder)); 21 | 22 | var options = new FusionCacheMetricsInstrumentationOptions(); 23 | configure?.Invoke(options); 24 | 25 | builder.AddMeter(FusionCacheDiagnostics.MeterName); 26 | if (options.IncludeMemoryLevel) 27 | builder.AddMeter(FusionCacheDiagnostics.MeterNameMemoryLevel); 28 | if (options.IncludeDistributedLevel) 29 | builder.AddMeter(FusionCacheDiagnostics.MeterNameDistributedLevel); 30 | if (options.IncludeBackplane) 31 | builder.AddMeter(FusionCacheDiagnostics.MeterNameBackplane); 32 | 33 | return builder; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.OpenTelemetry/TracerProviderBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion; 2 | using ZiggyCreatures.Caching.Fusion.OpenTelemetry; 3 | 4 | namespace OpenTelemetry.Trace; 5 | 6 | /// 7 | /// Contains extension methods to for enabling FusionCache traces instrumentation. 8 | /// 9 | public static class TracerProviderBuilderExtensions 10 | { 11 | /// 12 | /// Enable traces instrumentation for FusionCache. 13 | /// 14 | /// being configured. 15 | /// Callback action for configuring the available options. 16 | /// The instance of to chain the calls. 17 | public static TracerProviderBuilder AddFusionCacheInstrumentation(this TracerProviderBuilder builder, Action? configure = null) 18 | { 19 | if (builder is null) 20 | throw new ArgumentNullException(nameof(builder)); 21 | 22 | var options = new FusionCacheTracesInstrumentationOptions(); 23 | configure?.Invoke(options); 24 | 25 | builder.AddSource(FusionCacheDiagnostics.ActivitySourceName); 26 | if (options.IncludeMemoryLevel) 27 | builder.AddSource(FusionCacheDiagnostics.ActivitySourceNameMemoryLevel); 28 | if (options.IncludeDistributedLevel) 29 | builder.AddSource(FusionCacheDiagnostics.ActivitySourceNameDistributedLevel); 30 | if (options.IncludeBackplane) 31 | builder.AddSource(FusionCacheDiagnostics.ActivitySourceNameBackplane); 32 | 33 | return builder; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.OpenTelemetry/ZiggyCreatures.FusionCache.OpenTelemetry.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.OpenTelemetry 7 | Add native OpenTelemetry support to FusionCache. 8 | telemetry;observability;opentelemetry;open-telemetry;chaos;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.OpenTelemetry 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.OpenTelemetry/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.OpenTelemetry/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.OpenTelemetry/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package adds native [OpenTelemetry](https://opentelemetry.io/) instrumentation to FusionCache. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack/ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.1;net7.0;net8.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack 7 | FusionCache serializer based on Cysharp's MemoryPack serializer 8 | memorypack;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy;cache-stampede 9 | ZiggyCreatures.Caching.Fusion.Serialization.CysharpMemoryPack 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.CysharpMemoryPack/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is an implementation for a FusionCache serializer to be used with the optional distributed cache level, based on the uber fast new serializer [MemoryPack](https://github.com/Cysharp/MemoryPack). -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack/ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0;net7.0;net8.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack 7 | FusionCache serializer based on Neuecc's MessagePack serializer 8 | messagepack;msgpack;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy;cache-stampede 9 | ZiggyCreatures.Caching.Fusion.Serialization.NeueccMessagePack 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is an implementation for a FusionCache serializer to be used with the optional distributed cache level, based on the famous [Neuecc's MessagePack](https://github.com/neuecc/MessagePack-CSharp). -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson/ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson 7 | FusionCache serializer based on Newtonsoft Json.NET 8 | json;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy;cache-stampede 9 | ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.NewtonsoftJson/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is an implementation for a FusionCache serializer to be used with the optional distributed cache level, based on [Newtonsoft Json.NET](https://www.newtonsoft.com/json). -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet/Internals/FusionCacheEntryMetadataSurrogate.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | using ZiggyCreatures.Caching.Fusion.Internals; 3 | 4 | namespace ZiggyCreatures.Caching.Fusion.Serialization.ProtoBufNet.Internals; 5 | 6 | [ProtoContract] 7 | internal class FusionCacheEntryMetadataSurrogate 8 | { 9 | [ProtoMember(1)] 10 | public bool IsStale { get; set; } 11 | 12 | [ProtoMember(2)] 13 | public long? LastModifiedTimestamp { get; set; } 14 | 15 | [ProtoMember(3)] 16 | public string? ETag { get; set; } 17 | 18 | [ProtoMember(4)] 19 | public long? EagerExpirationTimestamp { get; set; } 20 | 21 | [ProtoMember(5)] 22 | public long? Size { get; set; } 23 | 24 | [ProtoMember(6)] 25 | public byte? Priority { get; set; } 26 | 27 | public static implicit operator FusionCacheEntryMetadataSurrogate?(FusionCacheEntryMetadata value) 28 | { 29 | if (value is null) 30 | return null; 31 | 32 | return new FusionCacheEntryMetadataSurrogate 33 | { 34 | IsStale = value.IsStale, 35 | EagerExpirationTimestamp = value.EagerExpirationTimestamp, 36 | ETag = value.ETag, 37 | LastModifiedTimestamp = value.LastModifiedTimestamp, 38 | Size = value.Size, 39 | Priority = value.Priority 40 | }; 41 | } 42 | 43 | public static implicit operator FusionCacheEntryMetadata?(FusionCacheEntryMetadataSurrogate value) 44 | { 45 | if (value is null) 46 | return null; 47 | 48 | return new FusionCacheEntryMetadata( 49 | value.IsStale, 50 | value.EagerExpirationTimestamp, 51 | value.ETag, 52 | value.LastModifiedTimestamp, 53 | value.Size, 54 | value.Priority 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Serialization.ProtoBufNet 7 | FusionCache serializer based on protobuf-net 8 | protobuf;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.Serialization.ProtoBufNet 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.ProtoBufNet/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is an implementation for a FusionCache serializer to be used with the optional distributed cache level, based on [protobuf-net](https://github.com/protobuf-net/protobuf-net), one of the most used Protobuf serializer on .NET. -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.ServiceStackJson/ZiggyCreatures.FusionCache.Serialization.ServiceStackJson.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Serialization.ServiceStackJson 7 | FusionCache serializer based on ServiceStack's Json serializer 8 | json;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy;cache-stampede 9 | ZiggyCreatures.Caching.Fusion.Serialization.ServiceStackJson 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.ServiceStackJson/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Serialization.ServiceStackJson/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.ServiceStackJson/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is an implementation for a FusionCache serializer to be used with the optional distributed cache level, based on the JSON serializer by [ServiceStack](https://docs.servicestack.net/json-format). -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.SystemTextJson/ZiggyCreatures.FusionCache.Serialization.SystemTextJson.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 2.2.0 6 | ZiggyCreatures.FusionCache.Serialization.SystemTextJson 7 | FusionCache serializer based on System.Text.Json 8 | json;caching;cache;hybrid;hybrid-cache;hybridcache;multi-level;multilevel;fusion;fusioncache;fusion-cache;performance;async;ziggy 9 | ZiggyCreatures.Caching.Fusion.Serialization.SystemTextJson 10 | true 11 | 12 | - Update: package dependencies 13 | 14 | 1.0.0 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.SystemTextJson/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache.Serialization.SystemTextJson/artwork/logo-128x128.png -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache.Serialization.SystemTextJson/docs/README.md: -------------------------------------------------------------------------------- 1 | # FusionCache 2 | 3 | ![FusionCache logo](https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/main/docs/logo-256x256.png) 4 | 5 | ### FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features. 6 | 7 | It was born after years of dealing with all sorts of different types of caches: memory caching, distributed caching, http caching, CDNs, browser cache, offline cache, you name it. So I've tried to put together these experiences and came up with FusionCache. 8 | 9 | Find out [more](https://github.com/ZiggyCreatures/FusionCache). 10 | 11 | ## 📦 This package 12 | 13 | This package is an implementation for a FusionCache serializer to be used with the optional distributed cache level, based on [System.Text.Json](https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to). -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Backplane/BackplaneConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Backplane; 2 | 3 | /// 4 | /// A struct containing information about a backplane connection or re-connection. 5 | /// 6 | public class BackplaneConnectionInfo 7 | { 8 | /// 9 | /// Creates a new instance. 10 | /// 11 | /// 12 | public BackplaneConnectionInfo(bool isReconnection) 13 | { 14 | IsReconnection = isReconnection; 15 | } 16 | 17 | /// 18 | /// If set to , the connection is a re-connection. 19 | /// 20 | public bool IsReconnection { get; } 21 | } 22 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Backplane/BackplaneMessageAction.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Backplane; 2 | 3 | /// 4 | /// The type of action for a backplane message. 5 | /// 6 | public enum BackplaneMessageAction : byte 7 | { 8 | /// 9 | /// Unknown action. 10 | /// 11 | Unknown = 0, 12 | /// 13 | /// A cache entry has been set (via either a Set() or a GetOrSet() method call). 14 | /// 15 | EntrySet = 1, 16 | /// 17 | /// A cache entry has been removed (via a Remove() method call). 18 | /// 19 | EntryRemove = 2, 20 | /// 21 | /// A cache entry has been manually expired (via an Expire() method call). 22 | /// 23 | EntryExpire = 3 24 | } 25 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Backplane/IFusionCacheBackplane.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Backplane; 2 | 3 | /// 4 | /// The core interface to create a FusionCache backplane. 5 | /// 6 | public interface IFusionCacheBackplane 7 | { 8 | /// 9 | /// Subscribe to receive messages from other nodes. 10 | /// 11 | /// The backplane subscription options. 12 | void Subscribe(BackplaneSubscriptionOptions options); 13 | 14 | /// 15 | /// Subscribe to receive messages from other nodes. 16 | /// 17 | /// The backplane subscription options. 18 | ValueTask SubscribeAsync(BackplaneSubscriptionOptions options); 19 | 20 | /// 21 | /// Unsubscribe from receiving messages from other nodes. 22 | /// 23 | void Unsubscribe(); 24 | 25 | /// 26 | /// Unsubscribe from receiving messages from other nodes. 27 | /// 28 | ValueTask UnsubscribeAsync(); 29 | 30 | /// 31 | /// Send a notification to the other connected nodes, if any. 32 | /// 33 | /// The message to send. 34 | /// The options to use. 35 | /// An optional to cancel the operation. 36 | ValueTask PublishAsync(BackplaneMessage message, FusionCacheEntryOptions options, CancellationToken token = default); 37 | 38 | /// 39 | /// Send a notification to the other connected nodes, if any. 40 | /// 41 | /// The message to send. 42 | /// The options to use. 43 | /// An optional to cancel the operation. 44 | void Publish(BackplaneMessage message, FusionCacheEntryOptions options, CancellationToken token = default); 45 | } 46 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/CacheKeyModifierMode.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The mode in which a cache modifier should be used to produce a cache key. 5 | /// 6 | public enum CacheKeyModifierMode 7 | { 8 | /// 9 | /// The cache modifier will be prepended, plus a separator. 10 | /// 11 | Prefix = 0, 12 | /// 13 | /// The cache modifier will be appended, plus a separator. 14 | /// 15 | Suffix = 1, 16 | /// 17 | /// The cache modifier will not be prepended. 18 | /// 19 | None = 2 20 | } 21 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/DangerZone/FusionCacheDangerZoneUtils.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.DangerZone; 2 | 3 | /// 4 | /// Utilities and extension methods that are dangerous to use, but may somehow be useful although only in some very very rare scenarios. 5 | ///

6 | /// ⚠️ WARNING: please, use with great care and only if you are really sure. 7 | ///
8 | public static class FusionCacheDangerZoneUtils 9 | { 10 | /// 11 | /// Set the InstanceId of the cache, but please don't use this. 12 | ///

13 | /// ⚠ WARNING: again, this should NOT be set, basically never ever, unless you really know what you are doing. For example by using the same value for two different cache instances they will be considered as the same cache instance, and this will lead to critical errors. So again, really: you should not use this. 14 | ///
15 | /// 16 | /// The value for . 17 | public static void SetInstanceId(this FusionCacheOptions options, string instanceId) 18 | { 19 | options.SetInstanceIdInternal(instanceId); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Events/FusionCacheAbstractEventsHub.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Events; 4 | 5 | /// 6 | /// An abstract class with base plumbing. 7 | /// 8 | public abstract class FusionCacheAbstractEventsHub 9 | { 10 | /// 11 | /// The instance. 12 | /// 13 | protected IFusionCache _cache; 14 | 15 | /// 16 | /// The instance. 17 | /// 18 | protected readonly FusionCacheOptions _options; 19 | 20 | /// 21 | /// The instance. 22 | /// 23 | protected readonly ILogger? _logger; 24 | 25 | /// 26 | /// The for errors during event handling. 27 | /// 28 | protected LogLevel _errorsLogLevel; 29 | 30 | /// 31 | /// The execution mode for event handlers. 32 | /// 33 | protected bool _syncExecution; 34 | 35 | /// 36 | /// Initializes a new instance of the class. 37 | /// 38 | /// The instance. 39 | /// The instance. 40 | /// The instance. 41 | protected FusionCacheAbstractEventsHub(IFusionCache cache, FusionCacheOptions options, ILogger? logger) 42 | { 43 | _cache = cache; 44 | _options = options; 45 | _logger = logger; 46 | 47 | _errorsLogLevel = _options.EventHandlingErrorsLogLevel; 48 | _syncExecution = _options.EnableSyncEventHandlersExecution; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Events/FusionCacheBackplaneMessageEventArgs.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion.Backplane; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Events; 4 | 5 | /// 6 | /// The specific object for events related to backplane messages, either published or received. 7 | /// 8 | public class FusionCacheBackplaneMessageEventArgs : EventArgs 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The backplane message. 14 | public FusionCacheBackplaneMessageEventArgs(BackplaneMessage message) 15 | { 16 | Message = message; 17 | } 18 | 19 | /// 20 | /// The backplane message. 21 | /// 22 | public BackplaneMessage Message { get; } 23 | } 24 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Events/FusionCacheCircuitBreakerChangeEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Events; 2 | 3 | /// 4 | /// The specific object for events related to opening/closing of a circuit breaker. 5 | /// 6 | public class FusionCacheCircuitBreakerChangeEventArgs : EventArgs 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// A flag that indicates if the circuit breaker has been opened or closed. 12 | public FusionCacheCircuitBreakerChangeEventArgs(bool isClosed) 13 | { 14 | IsClosed = isClosed; 15 | } 16 | 17 | /// 18 | /// A flag that indicates if the circuit breaker has been opened or closed. 19 | /// 20 | public bool IsClosed { get; } 21 | } 22 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Events/FusionCacheEntryEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Events; 2 | 3 | /// 4 | /// The specific object for events related to cache entries (eg: with a cache key). 5 | /// 6 | public class FusionCacheEntryEventArgs : EventArgs 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The cache key related to the event. 12 | public FusionCacheEntryEventArgs(string key) 13 | { 14 | Key = key; 15 | } 16 | 17 | /// 18 | /// The cache key related to the event. 19 | /// 20 | public string Key { get; } 21 | } 22 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Events/FusionCacheEntryEvictionEventArgs.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Caching.Memory; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Events; 4 | 5 | /// 6 | /// The specific object for events related to cache entries' evictions. 7 | /// 8 | public class FusionCacheEntryEvictionEventArgs 9 | : FusionCacheEntryEventArgs 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | /// The cache key related to the event. 15 | /// The reason for the eviction. 16 | /// The value being evicted from the cache. 17 | public FusionCacheEntryEvictionEventArgs(string key, EvictionReason reason, object? value) 18 | : base(key) 19 | { 20 | Reason = reason; 21 | Value = value; 22 | } 23 | 24 | /// 25 | /// The reason for the eviction. 26 | /// 27 | public EvictionReason Reason { get; } 28 | 29 | /// 30 | /// The value being evicted from the cache. 31 | /// 32 | public object? Value { get; } 33 | } 34 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Events/FusionCacheEntryHitEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Events; 2 | 3 | /// 4 | /// The specific object for events related to cache entries' hits (eg: with a cache key and a stale flag). 5 | /// 6 | public class FusionCacheEntryHitEventArgs : FusionCacheEntryEventArgs 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The cache key related to the event. 12 | /// A flag that indicates if the cache hit was for a fresh or stale entry. 13 | public FusionCacheEntryHitEventArgs(string key, bool isStale) 14 | : base(key) 15 | { 16 | IsStale = isStale; 17 | } 18 | 19 | /// 20 | /// A flag that indicates if the cache hit was for a fresh or stale entry. 21 | /// 22 | public bool IsStale { get; } 23 | } 24 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Events/FusionCacheTagEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Events; 2 | 3 | /// 4 | /// The specific object for events related to tag operations (eg: RemoveByTag). 5 | /// 6 | public class FusionCacheTagEventArgs : EventArgs 7 | { 8 | /// 9 | /// Initializes a new instance of the class. 10 | /// 11 | /// The cache key related to the event. 12 | public FusionCacheTagEventArgs(string tag) 13 | { 14 | Tag = tag; 15 | } 16 | 17 | /// 18 | /// The cache key related to the event. 19 | /// 20 | public string Tag { get; } 21 | } 22 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/FusionCacheBackplaneException.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The generic exception that is thrown when a distributed cache error occurs: the InnerException contains the original exception. 5 | /// 6 | [Serializable] 7 | public class FusionCacheBackplaneException 8 | : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public FusionCacheBackplaneException() 14 | { 15 | } 16 | 17 | /// Initializes a new instance of the class with a specified error message. 18 | /// The message that describes the error. 19 | public FusionCacheBackplaneException(string? message) 20 | : base(message) 21 | { 22 | } 23 | 24 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 25 | /// The error message that explains the reason for the exception. 26 | /// The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. 27 | public FusionCacheBackplaneException(string? message, Exception? innerException) 28 | : base(message, innerException) 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/FusionCacheDiagnostics.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// A support class for FusionCache diagnostics. 5 | /// 6 | public static class FusionCacheDiagnostics 7 | { 8 | /// 9 | /// The current version of FusionCache. 10 | /// 11 | public const string FusionCacheVersion = "2.2.0"; 12 | 13 | /// 14 | /// The activity source name for FusionCache. 15 | /// 16 | public const string ActivitySourceName = "ZiggyCreatures.Caching.Fusion"; 17 | 18 | /// 19 | /// The activity source name for the FusionCache memory level. 20 | /// 21 | public const string ActivitySourceNameMemoryLevel = "ZiggyCreatures.Caching.Fusion.Memory"; 22 | 23 | /// 24 | /// The activity source name for the FusionCache distributed level. 25 | /// 26 | public const string ActivitySourceNameDistributedLevel = "ZiggyCreatures.Caching.Fusion.Distributed"; 27 | 28 | /// 29 | /// The activity source name for the FusionCache backplane. 30 | /// 31 | public const string ActivitySourceNameBackplane = "ZiggyCreatures.Caching.Fusion.Backplane"; 32 | 33 | 34 | /// 35 | /// The meter name for FusionCache. 36 | /// 37 | public const string MeterName = "ZiggyCreatures.Caching.Fusion"; 38 | 39 | /// 40 | /// The meter name for the FusionCache memory level. 41 | /// 42 | public const string MeterNameMemoryLevel = "ZiggyCreatures.Caching.Fusion.Memory"; 43 | 44 | /// 45 | /// The meter name for the FusionCache distributed level. 46 | /// 47 | public const string MeterNameDistributedLevel = "ZiggyCreatures.Caching.Fusion.Distributed"; 48 | 49 | /// 50 | /// The meter name for the FusionCache backplane. 51 | /// 52 | public const string MeterNameBackplane = "ZiggyCreatures.Caching.Fusion.Backplane"; 53 | } 54 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/FusionCacheDistributedCacheException.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The generic exception that is thrown when a distributed cache error occurs: the InnerException contains the original exception. 5 | /// 6 | [Serializable] 7 | public class FusionCacheDistributedCacheException 8 | : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public FusionCacheDistributedCacheException() 14 | { 15 | } 16 | 17 | /// Initializes a new instance of the class with a specified error message. 18 | /// The message that describes the error. 19 | public FusionCacheDistributedCacheException(string? message) 20 | : base(message) 21 | { 22 | } 23 | 24 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 25 | /// The error message that explains the reason for the exception. 26 | /// The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. 27 | public FusionCacheDistributedCacheException(string? message, Exception? innerException) 28 | : base(message, innerException) 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/FusionCacheExtMethods.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// A set of extension methods that add some commonly used overloads to any instance of a instance and other common objects. 5 | /// 6 | public static partial class FusionCacheExtMethods 7 | { 8 | #region Dependency Injection 9 | 10 | /// 11 | /// Returns the default FusionCache instance, the one with the CacheName equals to . 12 | /// 13 | /// The default FusionCache instance. 14 | public static IFusionCache GetDefaultCache(this IFusionCacheProvider cacheProvider) 15 | { 16 | return cacheProvider.GetCache(FusionCacheOptions.DefaultCacheName); 17 | } 18 | 19 | /// 20 | /// Returns the default FusionCache instance, the one with the CacheName equals to , or if none found. 21 | /// 22 | /// The default FusionCache instance. 23 | public static IFusionCache? GetDefaultCacheOrNull(this IFusionCacheProvider cacheProvider) 24 | { 25 | return cacheProvider.GetCacheOrNull(FusionCacheOptions.DefaultCacheName); 26 | } 27 | 28 | #endregion 29 | } 30 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/FusionCacheFactoryException.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The exception thrown when a factory fails via the Fail() method and fail-safe was not enabled or possible. 5 | /// 6 | [Serializable] 7 | public class FusionCacheFactoryException 8 | : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public FusionCacheFactoryException() 14 | { 15 | } 16 | 17 | /// Initializes a new instance of the class with a specified error message. 18 | /// The message that describes the error. 19 | public FusionCacheFactoryException(string? message) 20 | : base(message) 21 | { 22 | } 23 | 24 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 25 | /// The error message that explains the reason for the exception. 26 | /// The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. 27 | public FusionCacheFactoryException(string? message, FusionCacheFactoryException? innerException) 28 | : base(message, innerException) 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/FusionCacheInvalidOptionsException.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The generic exception that is thrown when a distributed cache error occurs: the InnerException contains the original exception. 5 | /// 6 | [Serializable] 7 | public class FusionCacheInvalidOptionsException 8 | : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public FusionCacheInvalidOptionsException() 14 | { 15 | } 16 | 17 | /// Initializes a new instance of the class with a specified error message. 18 | /// The message that describes the error. 19 | public FusionCacheInvalidOptionsException(string? message) 20 | : base(message) 21 | { 22 | } 23 | 24 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 25 | /// The error message that explains the reason for the exception. 26 | /// The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. 27 | public FusionCacheInvalidOptionsException(string? message, Exception? innerException) 28 | : base(message, innerException) 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/FusionCacheSerializationException.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The generic exception that is thrown when a serialization error occurs: the InnerException contains the original exception. 5 | /// 6 | [Serializable] 7 | public class FusionCacheSerializationException 8 | : InvalidOperationException 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public FusionCacheSerializationException() 14 | { 15 | } 16 | 17 | /// Initializes a new instance of the class with a specified error message. 18 | /// The message that describes the error. 19 | public FusionCacheSerializationException(string? message) 20 | : base(message) 21 | { 22 | } 23 | 24 | /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 25 | /// The error message that explains the reason for the exception. 26 | /// The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. 27 | public FusionCacheSerializationException(string? message, Exception? innerException) 28 | : base(message, innerException) 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/GlobalAttributes.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("ZiggyCreatures.FusionCache.Benchmarks")] 4 | [assembly: InternalsVisibleTo("ZiggyCreatures.FusionCache.Tests")] 5 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Performance", "HAA0101:Array allocation for params parameter")] 9 | [assembly: SuppressMessage("Performance", "HAA0302:Display class allocation to capture closure")] 10 | [assembly: SuppressMessage("Performance", "HAA0301:Closure Allocation Source")] 11 | //[assembly: SuppressMessage("Performance", "HAA0303:Lambda or anonymous method in a generic method allocates a delegate instance")] 12 | //[assembly: SuppressMessage("Performance", "HAA0601:Value type to reference type conversion causing boxing allocation")] 13 | [assembly: SuppressMessage("Simplification", "RCS1049:Simplify boolean comparison.")] 14 | [assembly: SuppressMessage("Style", "IDE0090:Use 'new(...)'")] 15 | [assembly: SuppressMessage("Style", "IDE0290:Use primary constructor")] 16 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/IFusionCacheProvider.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The provider to work with multiple named FusionCache instances, kinda like Microsoft's HTTP named clients (see https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-requests#named-clients) 5 | /// 6 | public interface IFusionCacheProvider 7 | { 8 | /// 9 | /// Returns the FusionCache instance with the corresponding name. 10 | /// 11 | /// The name of the cache: it must match the one provided during registration. 12 | /// The FusionCache instance corresponding to the cache name specified. 13 | IFusionCache GetCache(string cacheName); 14 | 15 | /// 16 | /// Returns the FusionCache instance with the corresponding name, or if none found. 17 | /// 18 | /// The name of the cache: it must match the one provided during registration. 19 | /// The FusionCache instance corresponding to the cache name specified. 20 | IFusionCache? GetCacheOrNull(string cacheName); 21 | } 22 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Internals/AutoRecovery/AutoRecoveryItem.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Internals.AutoRecovery; 4 | 5 | [DebuggerDisplay("{" + nameof(Action) + "} ON {" + nameof(CacheKey) + "} AT {" + nameof(Timestamp) + "} (EXP: {" + nameof(ExpirationTicks) + "} RET: {" + nameof(RetryCount) + "})")] 6 | internal sealed class AutoRecoveryItem 7 | { 8 | public AutoRecoveryItem(string cacheKey, FusionCacheAction action, long timestamp, FusionCacheEntryOptions options, long expirationTicks, int? maxRetryCount) 9 | { 10 | CacheKey = cacheKey; 11 | Action = action; 12 | Timestamp = timestamp; 13 | Options = options ?? throw new ArgumentNullException(nameof(options)); 14 | ExpirationTicks = expirationTicks; 15 | RetryCount = maxRetryCount; 16 | } 17 | 18 | public string CacheKey { get; } 19 | public FusionCacheAction Action { get; } 20 | public long Timestamp { get; } 21 | public FusionCacheEntryOptions Options { get; } 22 | public long ExpirationTicks { get; } 23 | public int? RetryCount { get; private set; } 24 | 25 | public bool IsExpired() 26 | { 27 | return ExpirationTicks <= DateTimeOffset.UtcNow.Ticks; 28 | } 29 | 30 | public void RecordRetry() 31 | { 32 | if (RetryCount is not null) 33 | RetryCount--; 34 | } 35 | 36 | public bool CanRetry() 37 | { 38 | if (RetryCount is null) 39 | return true; 40 | 41 | return RetryCount.Value > 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Internals/Diagnostics/CacheLevelKind.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Internals.Diagnostics; 2 | 3 | internal enum CacheLevelKind 4 | { 5 | Memory = 0, 6 | Distributed = 1 7 | } 8 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Internals/Diagnostics/Tags.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Internals.Diagnostics; 2 | 3 | internal static class Tags 4 | { 5 | internal static class Names 6 | { 7 | public const string CacheName = "fusioncache.cache.name"; 8 | public const string CacheInstanceId = "fusioncache.cache.instance_id"; 9 | 10 | public const string OperationKey = "fusioncache.operation.key"; 11 | public const string OperationId = "fusioncache.operation.operation_id"; 12 | public const string OperationTag = "fusioncache.operation.tag"; 13 | public const string OperationLevel = "fusioncache.operation.level"; 14 | public const string OperationBackground = "fusioncache.operation.background"; 15 | 16 | public const string Hit = "fusioncache.hit"; 17 | public const string Stale = "fusioncache.stale"; 18 | 19 | public const string FactoryEagerRefresh = "fusioncache.factory.eager_refresh"; 20 | 21 | 22 | public const string MemoryEvictReason = "fusioncache.memory.evict_reason"; 23 | 24 | public const string DistributedCircuitBreakerClosed = "fusioncache.distributed.circuit_breaker.closed"; 25 | 26 | public const string BackplaneCircuitBreakerClosed = "fusioncache.backplane.circuit_breaker.closed"; 27 | public const string BackplaneMessageAction = "fusioncache.backplane.message_action"; 28 | public const string BackplaneMessageSourceId = "fusioncache.backplane.message_source_id"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Internals/FusionCacheAction.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Internals; 2 | 3 | internal enum FusionCacheAction 4 | { 5 | Unknown = 0, 6 | EntrySet = 1, 7 | EntryRemove = 2, 8 | EntryExpire = 3 9 | } 10 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Internals/ImmutableTypeCache.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Internals; 2 | 3 | // SOURCE: https://github.com/dotnet/extensions/blob/main/src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/ImmutableTypeCache.T.cs 4 | // COPIED (ALMOST) AS-IS FOR MAXIMUM COMPATIBILITY WITH HybridCache 5 | internal static class ImmutableTypeCache // lazy memoize; T doesn't change per cache instance 6 | { 7 | // note for blittable types: a pure struct will be a full copy every time - nothing shared to mutate 8 | public static readonly bool IsImmutable = /*(typeof(T).IsValueType && ImmutableTypeCache.IsBlittable()) ||*/ FusionCacheInternalUtils.IsTypeImmutable(typeof(T)); 9 | } 10 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Internals/Memory/IFusionCacheMemoryEntry.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion.Internals.Distributed; 2 | using ZiggyCreatures.Caching.Fusion.Serialization; 3 | 4 | namespace ZiggyCreatures.Caching.Fusion.Internals.Memory; 5 | 6 | /// 7 | /// Represents a memory entry in , but as a non-generic interface so it can be used from code that doesn't know the actual type of the value (eg: auto-recovery and other places). 8 | /// 9 | internal interface IFusionCacheMemoryEntry 10 | : IFusionCacheEntry 11 | { 12 | object? Value { get; } 13 | 14 | byte[] GetSerializedValue(IFusionCacheSerializer serializer); 15 | 16 | (bool error, bool isSame, bool hasUpdated) TryUpdateMemoryEntryFromDistributedEntry(string operationId, string cacheKey, FusionCache cache); 17 | ValueTask<(bool error, bool isSame, bool hasUpdated)> TryUpdateMemoryEntryFromDistributedEntryAsync(string operationId, string cacheKey, FusionCache cache); 18 | 19 | ValueTask SetDistributedEntryAsync(string operationId, string key, DistributedCacheAccessor dca, FusionCacheEntryOptions options, bool isBackground, CancellationToken token); 20 | } 21 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Internals/Provider/LazyNamedCache.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Internals.Provider; 4 | 5 | [DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")] 6 | internal sealed class LazyNamedCache : IDisposable 7 | { 8 | private string GetDebuggerDisplay() 9 | { 10 | return $"CACHE: {CacheName} - INSTANTIATED: {_cache is not null}"; 11 | } 12 | 13 | public LazyNamedCache(string name, Func cacheFactory) 14 | { 15 | if (name is null) 16 | throw new ArgumentNullException(nameof(name)); 17 | 18 | if (cacheFactory is null) 19 | throw new ArgumentNullException(nameof(cacheFactory)); 20 | 21 | CacheName = name; 22 | _cacheFactory = cacheFactory; 23 | } 24 | 25 | public LazyNamedCache(string name, IFusionCache cache) 26 | { 27 | if (name is null) 28 | throw new ArgumentNullException(nameof(name)); 29 | 30 | if (cache is null) 31 | throw new ArgumentNullException(nameof(cache)); 32 | 33 | CacheName = name; 34 | _cache = cache; 35 | } 36 | 37 | private readonly object _mutex = new(); 38 | private IFusionCache? _cache; 39 | private readonly Func? _cacheFactory; 40 | 41 | public string CacheName { get; } 42 | 43 | public IFusionCache Cache 44 | { 45 | get 46 | { 47 | if (_cache is not null) 48 | return _cache; 49 | 50 | lock (_mutex) 51 | { 52 | if (_cache is not null) 53 | return _cache; 54 | 55 | if (_cacheFactory is null) 56 | throw new InvalidOperationException("No cache and no cache factory specified: this should not be possible."); 57 | 58 | return _cache = _cacheFactory(); 59 | } 60 | } 61 | } 62 | 63 | public void Dispose() 64 | { 65 | _cache?.Dispose(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/NullObjects/NullBackplane.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion.Backplane; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.NullObjects; 4 | 5 | /// 6 | /// An implementation of that implements the null object pattern, meaning that it does nothing. Consider this a kind of a pass-through implementation. 7 | /// 8 | public class NullBackplane 9 | : IFusionCacheBackplane 10 | { 11 | /// 12 | public void Subscribe(BackplaneSubscriptionOptions options) 13 | { 14 | // EMPTY 15 | } 16 | 17 | /// 18 | public ValueTask SubscribeAsync(BackplaneSubscriptionOptions options) 19 | { 20 | return new ValueTask(); 21 | } 22 | 23 | /// 24 | public void Unsubscribe() 25 | { 26 | // EMPTY 27 | } 28 | 29 | /// 30 | public ValueTask UnsubscribeAsync() 31 | { 32 | return new ValueTask(); 33 | } 34 | 35 | /// 36 | public void Publish(BackplaneMessage message, FusionCacheEntryOptions options, CancellationToken token = default) 37 | { 38 | // EMPTY 39 | } 40 | 41 | /// 42 | public ValueTask PublishAsync(BackplaneMessage message, FusionCacheEntryOptions options, CancellationToken token = default) 43 | { 44 | return new ValueTask(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/NullObjects/NullDistributedCache.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Caching.Distributed; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.NullObjects; 4 | 5 | /// 6 | /// An implementation of that implements the null object pattern, meaning that it does nothing. Consider this a kind of a pass-through implementation. 7 | /// 8 | public class NullDistributedCache 9 | : IDistributedCache 10 | { 11 | /// 12 | public byte[]? Get(string key) 13 | { 14 | return null!; 15 | } 16 | 17 | /// 18 | public Task GetAsync(string key, CancellationToken token = default) 19 | { 20 | return Task.FromResult(null!); 21 | } 22 | 23 | /// 24 | public void Refresh(string key) 25 | { 26 | // EMPTY 27 | } 28 | 29 | /// 30 | public Task RefreshAsync(string key, CancellationToken token = default) 31 | { 32 | return Task.CompletedTask; 33 | } 34 | 35 | /// 36 | public void Remove(string key) 37 | { 38 | // EMPTY 39 | } 40 | 41 | /// 42 | public Task RemoveAsync(string key, CancellationToken token = default) 43 | { 44 | return Task.CompletedTask; 45 | } 46 | 47 | /// 48 | public void Set(string key, byte[] value, DistributedCacheEntryOptions options) 49 | { 50 | // EMPTY 51 | } 52 | 53 | /// 54 | public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default) 55 | { 56 | return Task.CompletedTask; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/NullObjects/NullMemoryLocker.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using ZiggyCreatures.Caching.Fusion.Locking; 3 | 4 | namespace ZiggyCreatures.Caching.Fusion.NullObjects; 5 | 6 | /// 7 | /// An implementation of that implements the null object pattern, meaning that it does nothing. Consider this a kind of a pass-through implementation. 8 | /// 9 | public class NullMemoryLocker 10 | : IFusionCacheMemoryLocker 11 | { 12 | /// 13 | public object? AcquireLock(string cacheName, string cacheInstanceId, string operationId, string key, TimeSpan timeout, ILogger? logger, CancellationToken token) 14 | { 15 | return null; 16 | } 17 | 18 | /// 19 | public ValueTask AcquireLockAsync(string cacheName, string cacheInstanceId, string operationId, string key, TimeSpan timeout, ILogger? logger, CancellationToken token) 20 | { 21 | return new ValueTask((object?)null); 22 | } 23 | 24 | /// 25 | public void ReleaseLock(string cacheName, string cacheInstanceId, string operationId, string key, object? lockObj, ILogger? logger) 26 | { 27 | // EMPTY 28 | } 29 | 30 | /// 31 | public void Dispose() 32 | { 33 | // EMTPY 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/NullObjects/NullPlugin.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion.Plugins; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.NullObjects; 4 | 5 | /// 6 | /// An implementation of that implements the null object pattern, meaning that it does nothing. 7 | /// 8 | public class NullPlugin 9 | : IFusionCachePlugin 10 | { 11 | /// 12 | public void Start(IFusionCache cache) 13 | { 14 | // EMPTY 15 | } 16 | 17 | /// 18 | public void Stop(IFusionCache cache) 19 | { 20 | // EMPTY 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/NullObjects/NullSerializer.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion.Serialization; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.NullObjects; 4 | 5 | /// 6 | /// An implementation of that implements the null object pattern, meaning that it does nothing. 7 | /// 8 | public class NullSerializer 9 | : IFusionCacheSerializer 10 | { 11 | /// 12 | public byte[] Serialize(T? obj) 13 | { 14 | return []; 15 | } 16 | 17 | /// 18 | public T? Deserialize(byte[] data) 19 | { 20 | return default; 21 | } 22 | 23 | /// 24 | public ValueTask SerializeAsync(T? obj, CancellationToken token = default) 25 | { 26 | return new ValueTask([]); 27 | } 28 | 29 | /// 30 | public ValueTask DeserializeAsync(byte[] data, CancellationToken token = default) 31 | { 32 | return new ValueTask(default(T?)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/Plugins/IFusionCachePlugin.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Plugins; 2 | 3 | /// 4 | /// The core plugin interface to implement to create a FusionCache plugin. 5 | /// 6 | public interface IFusionCachePlugin 7 | { 8 | /// 9 | /// This method is called right after adding the plugin to a FusionCache instance. If it throws, the plugin will be automatically removed. 10 | /// 11 | /// The FusionCache instance on which to operate. 12 | void Start(IFusionCache cache); 13 | 14 | /// 15 | /// This method is called right before removing the plugin from a FusionCache instance. 16 | /// 17 | /// The FusionCache instance on which to operate. 18 | void Stop(IFusionCache cache); 19 | } 20 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/SyntheticTimeoutException.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion; 2 | 3 | /// 4 | /// The exception that is thrown when the time allotted for a process or operation has expired. 5 | /// 6 | [Serializable] 7 | public class SyntheticTimeoutException 8 | : TimeoutException 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public SyntheticTimeoutException() 14 | { 15 | } 16 | 17 | /// Initializes a new instance of the class with the specified error message. 18 | /// The message that describes the error. 19 | public SyntheticTimeoutException(string? message) 20 | : base(message) 21 | { 22 | } 23 | 24 | /// Initializes a new instance of the class with the specified error message and inner exception. 25 | /// The message that describes the error. 26 | /// The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception. 27 | public SyntheticTimeoutException(string? message, Exception? innerException) 28 | : base(message, innerException) 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/ZiggyCreatures.FusionCache/artwork/logo-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/src/ZiggyCreatures.FusionCache/artwork/logo-128x128.png -------------------------------------------------------------------------------- /tests/AOTTester/AOTTester.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net9.0 6 | enable 7 | enable 8 | true 9 | 10 | true 11 | true 12 | true 13 | true 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/AOTTester/Program.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion; 2 | 3 | namespace AOTTester; 4 | 5 | internal class Program 6 | { 7 | static async Task Main(string[] args) 8 | { 9 | var cache = new FusionCache(new FusionCacheOptions()); 10 | 11 | var value = await cache.GetOrSetAsync("foo", async (ctx, ct) => 42); 12 | 13 | Console.WriteLine($"VALUE: {value}"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/SerializerPayloadGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Always 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_20_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_21_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_22_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_23_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_24_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_25_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v0_26_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v1_0_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v1_1_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncachecysharpmemorypackserializer__v1_2_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_20_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_21_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_22_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_23_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_24_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_25_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v0_26_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v1_0_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v1_1_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheneueccmessagepackserializer__v1_2_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true}} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"}} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":1690645706229} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638310588939961396} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169109525425} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169884131030} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437170635705174} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638495379923677199} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638528613274343519} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachenewtonsoftjsonserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638583875279735253} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_20_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_21_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_22_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_23_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_24_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_25_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v0_26_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v1_0_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v1_1_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/SerializerPayloadGenerator/Snapshots/fusioncacheprotobufnetserializer__v1_2_0_0.bin -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"\/Date(2004447193452)\/","f":true}} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"}} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":1690645706229} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638310588939961396} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169109525425} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169884131030} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437170635705174} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638495379923677199} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638528613274343519} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncacheservicestackjsonserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638583875279735253} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true}} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"}} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":1690645706229} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638310588939961396} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638437169109525425} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638437169884131030} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638437170635705174} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638495379923677199} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638528613274343519} -------------------------------------------------------------------------------- /tests/SerializerPayloadGenerator/Snapshots/fusioncachesystemtextjsonserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638583875279735253} -------------------------------------------------------------------------------- /tests/WebAppTest/Controllers/MvcController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.OutputCaching; 3 | 4 | namespace WebAppTest.Controllers; 5 | 6 | [ApiController] 7 | [Route("[controller]")] 8 | public class MvcController : ControllerBase 9 | { 10 | private readonly ILogger _logger; 11 | 12 | public MvcController(ILogger logger) 13 | { 14 | _logger = logger; 15 | } 16 | 17 | [HttpGet("now")] 18 | public DateTimeOffset Now() 19 | { 20 | return DateTimeOffset.UtcNow; 21 | } 22 | 23 | [HttpGet("now-cached-2")] 24 | [OutputCache(PolicyName = "Expire2")] 25 | public DateTimeOffset NowCached2() 26 | { 27 | return DateTimeOffset.UtcNow; 28 | } 29 | 30 | [HttpGet("now-cached-5")] 31 | [OutputCache(PolicyName = "Expire5")] 32 | public DateTimeOffset NowCached5() 33 | { 34 | return DateTimeOffset.UtcNow; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/WebAppTest/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "http": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "launchBrowser": false, 8 | "applicationUrl": "http://localhost:5286", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | } 12 | }, 13 | "https": { 14 | "commandName": "Project", 15 | "dotnetRunMessages": true, 16 | "launchBrowser": false, 17 | "applicationUrl": "https://localhost:7251;http://localhost:5286", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/WebAppTest/WebAppTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net9.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/WebAppTest/WebAppTest.http: -------------------------------------------------------------------------------- 1 | @WebAppTest_HostAddress = http://localhost:5286 2 | 3 | GET {{WebAppTest_HostAddress}}/weatherforecast/ 4 | Accept: application/json 5 | 6 | ### 7 | -------------------------------------------------------------------------------- /tests/WebAppTest/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/WebAppTest/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Playground/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("AsyncUsage", "AsyncFixer01:Unnecessary async/await usage", Justification = "")] 9 | [assembly: SuppressMessage("Simplification", "RCS1049:Simplify boolean comparison.", Justification = "")] 10 | [assembly: SuppressMessage("Style", "IDE0290:Use primary constructor", Justification = "")] 11 | [assembly: SuppressMessage("Style", "IDE0090:Use 'new(...)'", Justification = "")] 12 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Playground/Program.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion.Playground.Scenarios; 2 | 3 | namespace ZiggyCreatures.Caching.Fusion.Playground; 4 | 5 | class Program 6 | { 7 | static async Task Main(string[] args) 8 | { 9 | await ScratchpadScenario.RunAsync().ConfigureAwait(false); 10 | //await LoggingScenario.RunAsync().ConfigureAwait(false); 11 | //await OpenTelemetryScenario.RunAsync().ConfigureAwait(false); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Playground/ZiggyCreatures.FusionCache.Playground.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | false 7 | ZiggyCreatures.Caching.Fusion.Playground 8 | 1f4e47b6-6dd9-49b0-af63-058750249662 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Simulator/Stuff/BackplaneType.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Simulator.Stuff; 2 | 3 | public enum BackplaneType 4 | { 5 | None = 0, 6 | Memory = 1, 7 | Redis = 2 8 | } 9 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Simulator/Stuff/DistributedCacheType.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Simulator.Stuff; 2 | 3 | public enum DistributedCacheType 4 | { 5 | None = 0, 6 | Memory = 1, 7 | Redis = 2, 8 | FASTER = 3 9 | } 10 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Simulator/Stuff/SimulatedCluster.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Simulator.Stuff; 2 | 3 | public class SimulatedCluster 4 | { 5 | public List Nodes { get; } = new(); 6 | public int? LastUpdatedNodeIndex { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Simulator/Stuff/SimulatedDatabase.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Simulator.Stuff; 2 | 3 | public class SimulatedDatabase 4 | { 5 | public int? Value { get; set; } 6 | public long? LastUpdateTimestamp { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Simulator/Stuff/SimulatedNode.cs: -------------------------------------------------------------------------------- 1 | namespace ZiggyCreatures.Caching.Fusion.Simulator.Stuff; 2 | 3 | public class SimulatedNode 4 | { 5 | public SimulatedNode(IFusionCache cache) 6 | { 7 | Cache = cache; 8 | } 9 | 10 | public IFusionCache Cache { get; } 11 | } 12 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Simulator/ZiggyCreatures.FusionCache.Simulator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | false 7 | ZiggyCreatures.Caching.Fusion.Simulator 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/EventsTests.cs: -------------------------------------------------------------------------------- 1 | using FusionCacheTests.Stuff; 2 | using Xunit; 3 | 4 | namespace FusionCacheTests; 5 | 6 | public partial class EventsTests 7 | : AbstractTests 8 | { 9 | public EventsTests(ITestOutputHelper output) 10 | : base(output, null) 11 | { 12 | } 13 | 14 | private readonly TimeSpan InitialBackplaneDelay = TimeSpan.FromMilliseconds(300); 15 | } 16 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. 3 | // Project-level suppressions either have no target or are given 4 | // a specific target and scoped to a namespace, type, member, etc. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | [assembly: SuppressMessage("Performance", "HAA0301:Closure Allocation Source")] 9 | [assembly: SuppressMessage("Performance", "HAA0302:Display class allocation to capture closure")] 10 | [assembly: SuppressMessage("Style", "IDE0290:Use primary constructor")] 11 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/L1L2Tests.cs: -------------------------------------------------------------------------------- 1 | using FusionCacheTests.Stuff; 2 | using Microsoft.Extensions.Caching.Distributed; 3 | using Microsoft.Extensions.Caching.Memory; 4 | using Microsoft.Extensions.Caching.StackExchangeRedis; 5 | using Microsoft.Extensions.Options; 6 | using Xunit; 7 | using ZiggyCreatures.Caching.Fusion; 8 | 9 | namespace FusionCacheTests; 10 | 11 | public partial class L1L2Tests 12 | : AbstractTests 13 | { 14 | private static readonly bool UseRedis = false; 15 | private static readonly string RedisConnection = "127.0.0.1:6379,ssl=False,abortConnect=false,connectTimeout=1000,syncTimeout=1000"; 16 | 17 | public L1L2Tests(ITestOutputHelper output) 18 | : base(output, "MyCache:") 19 | { 20 | } 21 | 22 | private FusionCacheOptions CreateFusionCacheOptions(string? cacheName = null, Action? configure = null) 23 | { 24 | var res = new FusionCacheOptions 25 | { 26 | CacheKeyPrefix = TestingCacheKeyPrefix 27 | }; 28 | 29 | if (string.IsNullOrWhiteSpace(cacheName) == false) 30 | { 31 | res.CacheName = cacheName; 32 | res.CacheKeyPrefix = cacheName + ":"; 33 | } 34 | 35 | configure?.Invoke(res); 36 | 37 | return res; 38 | } 39 | 40 | private static IDistributedCache CreateDistributedCache() 41 | { 42 | if (UseRedis) 43 | return new RedisCache(new RedisCacheOptions() { Configuration = RedisConnection }); 44 | 45 | return new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions())); 46 | } 47 | 48 | private static string CreateRandomCacheName(string cacheName) 49 | { 50 | return cacheName + "_" + Guid.NewGuid().ToString("N"); 51 | } 52 | 53 | private static string CreateRandomCacheKey(string key) 54 | { 55 | return key + "_" + Guid.NewGuid().ToString("N"); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/L1Tests.cs: -------------------------------------------------------------------------------- 1 | using FusionCacheTests.Stuff; 2 | using Xunit; 3 | 4 | namespace FusionCacheTests; 5 | 6 | public partial class L1Tests 7 | : AbstractTests 8 | { 9 | public L1Tests(ITestOutputHelper output) 10 | : base(output, null) 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/OtherLibs/CacheStampedeTests_CacheManager.cs: -------------------------------------------------------------------------------- 1 | using CacheManager.Core; 2 | using Xunit; 3 | 4 | namespace FusionCacheTests.OtherLibs; 5 | 6 | // REMOVE THE abstract MODIFIER TO RUN THESE TESTS 7 | public abstract class CacheStampedeTests_CacheManager 8 | { 9 | private static readonly TimeSpan FactoryDuration = TimeSpan.FromMilliseconds(500); 10 | 11 | [Theory] 12 | [InlineData(10)] 13 | [InlineData(100)] 14 | [InlineData(1_000)] 15 | public void OnlyOneFactoryGetsCalledEvenInHighConcurrency(int accessorsCount) 16 | { 17 | using (var cache = CacheFactory.Build(p => p.WithMicrosoftMemoryCacheHandle())) 18 | { 19 | var factoryCallsCount = 0; 20 | 21 | Parallel.For(0, accessorsCount, _ => 22 | { 23 | cache.GetOrAdd( 24 | "foo", 25 | key => 26 | { 27 | Interlocked.Increment(ref factoryCallsCount); 28 | Thread.Sleep(FactoryDuration); 29 | return new CacheItem( 30 | key, 31 | 42, 32 | ExpirationMode.Absolute, 33 | TimeSpan.FromSeconds(10) 34 | ); 35 | } 36 | ); 37 | }); 38 | 39 | Assert.Equal(1, factoryCallsCount); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/OtherLibs/CacheStampedeTests_CacheTower.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using CacheTower; 3 | using CacheTower.Extensions; 4 | using CacheTower.Providers.Memory; 5 | using Xunit; 6 | 7 | namespace FusionCacheTests.OtherLibs; 8 | 9 | // REMOVE THE abstract MODIFIER TO RUN THESE TESTS 10 | public abstract class CacheStampedeTests_CacheTower 11 | { 12 | private static readonly TimeSpan FactoryDuration = TimeSpan.FromMilliseconds(500); 13 | 14 | [Theory] 15 | [InlineData(10)] 16 | [InlineData(100)] 17 | [InlineData(1_000)] 18 | public async Task OnlyOneFactoryGetsCalledEvenInHighConcurrencyAsync(int accessorsCount) 19 | { 20 | await using (var cache = new CacheStack(null, new CacheStackOptions([new MemoryCacheLayer()]) { Extensions = [new AutoCleanupExtension(TimeSpan.FromMinutes(5))] })) 21 | { 22 | var cacheSettings = new CacheSettings(TimeSpan.FromSeconds(10)); 23 | 24 | var factoryCallsCount = 0; 25 | 26 | var tasks = new ConcurrentBag(); 27 | Parallel.For(0, accessorsCount, _ => 28 | { 29 | var task = cache.GetOrSetAsync( 30 | "foo", 31 | async old => 32 | { 33 | Interlocked.Increment(ref factoryCallsCount); 34 | await Task.Delay(FactoryDuration); 35 | return 42; 36 | }, 37 | cacheSettings 38 | ); 39 | tasks.Add(task.AsTask()); 40 | }); 41 | 42 | await Task.WhenAll(tasks); 43 | 44 | Assert.Equal(1, factoryCallsCount); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/OtherLibs/CacheStampedeTests_HybridCache.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using Microsoft.Extensions.Caching.Hybrid; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Xunit; 5 | 6 | namespace FusionCacheTests.OtherLibs; 7 | 8 | // REMOVE THE abstract MODIFIER TO RUN THESE TESTS 9 | public abstract class CacheStampedeTests_HybridCache 10 | { 11 | private static readonly TimeSpan FactoryDuration = TimeSpan.FromMilliseconds(500); 12 | 13 | [Theory] 14 | [InlineData(10)] 15 | [InlineData(100)] 16 | [InlineData(1_000)] 17 | public async Task OnlyOneFactoryGetsCalledEvenInHighConcurrencyAsync(int accessorsCount) 18 | { 19 | var services = new ServiceCollection(); 20 | 21 | #pragma warning disable EXTEXP0018 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. 22 | services.AddHybridCache(); 23 | #pragma warning restore EXTEXP0018 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. 24 | 25 | var serviceProvider = services.BuildServiceProvider(); 26 | 27 | var cache = serviceProvider.GetRequiredService(); 28 | 29 | var factoryCallsCount = 0; 30 | 31 | var entryOptions = new HybridCacheEntryOptions 32 | { 33 | LocalCacheExpiration = TimeSpan.FromMinutes(5) 34 | }; 35 | 36 | var tasks = new ConcurrentBag(); 37 | Parallel.For(0, accessorsCount, _ => 38 | { 39 | var task = cache.GetOrCreateAsync( 40 | "foo", 41 | async _ => 42 | { 43 | Interlocked.Increment(ref factoryCallsCount); 44 | await Task.Delay(FactoryDuration); 45 | return 42; 46 | }, 47 | entryOptions 48 | ); 49 | tasks.Add(task.AsTask()); 50 | }); 51 | 52 | await Task.WhenAll(tasks); 53 | 54 | Assert.Equal(1, factoryCallsCount); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Overloads/OverloadsCallsTryouts.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion; 2 | 3 | namespace FusionCacheTests.Overloads; 4 | 5 | // THIS THING IS JUST A WAY TO TEST THAT EVERY NEEDED PERMUTATION OF CALLS+ARGS IS AVAILABLE, BOTH SYNC AND ASYNC 6 | internal static partial class OverloadsCallsTryouts 7 | { 8 | static readonly string Key = "foo"; 9 | 10 | static readonly Func> AsyncFactory = async _ => 42; 11 | static readonly Func SyncFactory = _ => 42; 12 | 13 | static readonly int? DefaultValue = 42; 14 | 15 | static readonly TimeSpan Duration = TimeSpan.FromMinutes(10); 16 | static readonly Action OptionsLambda = options => options.SetDuration(Duration); 17 | static readonly FusionCacheEntryOptions Options = new(Duration); 18 | } 19 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/PluginsTests.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests; 2 | 3 | public partial class PluginsTests 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/RunUtilsTests.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests; 2 | 3 | public partial class RunUtilsTests 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/SerializationTests.cs: -------------------------------------------------------------------------------- 1 | using FusionCacheTests.Stuff; 2 | using Xunit; 3 | 4 | namespace FusionCacheTests; 5 | 6 | public partial class SerializationTests 7 | : AbstractTests 8 | { 9 | private static readonly ComplexType[] BigData; 10 | 11 | static SerializationTests() 12 | { 13 | var len = 1024 * 1024; 14 | BigData = new ComplexType[len]; 15 | for (int i = 0; i < len; i++) 16 | { 17 | BigData[i] = ComplexType.CreateSample(); 18 | } 19 | } 20 | 21 | public SerializationTests(ITestOutputHelper output) 22 | : base(output, null) 23 | { 24 | } 25 | 26 | private const string SampleString = "Supercalifragilisticexpialidocious"; 27 | } 28 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_20_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_21_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_22_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_23_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_24_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_25_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v0_26_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v1_0_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v1_1_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachecysharpmemorypackserializer__v1_2_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_20_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_21_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_22_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_23_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_24_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_25_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v0_26_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v1_0_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v1_1_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheneueccmessagepackserializer__v1_2_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true}} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"}} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":1690645706229} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638310588939961396} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169109525425} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169884131030} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437170635705174} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638495379923677199} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638528613274343519} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachenewtonsoftjsonserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638583875279735253} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_20_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_21_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_22_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_23_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_24_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_25_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v0_26_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v1_0_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v1_1_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZiggyCreatures/FusionCache/2473560bf14a99411947a13ae3c40b41684c3fa7/tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheprotobufnetserializer__v1_2_0_0.bin -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"\/Date(2004447193452)\/","f":true}} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"}} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":1690645706229} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638310588939961396} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169109525425} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437169884131030} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638437170635705174} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638495379923677199} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638528613274343519} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncacheservicestackjsonserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- 1 | {"v":"Sloths are cool!","m":{"e":"2033-07-08T14:53:13.4520833+00:00","f":true,"ea":"2033-06-28T14:53:13.4520833+00:00","et":"MyETagValue","lm":"2033-03-30T14:53:13.4520833+00:00"},"t":638583875279735253} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v0_20_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true}} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v0_21_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"}} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v0_22_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":1690645706229} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v0_23_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638310588939961396} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v0_24_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638437169109525425} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v0_25_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638437169884131030} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v0_26_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638437170635705174} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v1_0_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638495379923677199} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v1_1_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638528613274343519} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Snapshots/fusioncachesystemtextjsonserializer__v1_2_0_0.bin: -------------------------------------------------------------------------------- 1 | {"Value":"Sloths are cool!","Metadata":{"LogicalExpiration":"2033-07-08T14:53:13.4520833+00:00","IsFromFailSafe":true,"EagerExpiration":"2033-06-28T14:53:13.4520833+00:00","ETag":"MyETagValue","LastModified":"2033-03-30T14:53:13.4520833+00:00"},"Timestamp":638583875279735253} -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/AbstractTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Xunit; 3 | 4 | namespace FusionCacheTests.Stuff; 5 | 6 | public abstract class AbstractTests 7 | { 8 | protected AbstractTests(ITestOutputHelper output, string? testingCacheKeyPrefix) 9 | { 10 | TestOutput = output; 11 | TestingCacheKeyPrefix = testingCacheKeyPrefix; 12 | } 13 | 14 | protected ITestOutputHelper TestOutput { get; } 15 | 16 | protected string? TestingCacheKeyPrefix { get; } 17 | 18 | protected XUnitLogger CreateXUnitLogger(LogLevel minLevel = LogLevel.Trace) 19 | { 20 | return new XUnitLogger(minLevel, TestOutput); 21 | } 22 | 23 | protected static ListLogger CreateListLogger(LogLevel minLogLevel) 24 | { 25 | return new ListLogger(minLogLevel); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/CacheStampedeClassData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace FusionCacheTests.Stuff; 4 | 5 | public class CacheStampedeClassData : IEnumerable 6 | { 7 | private static readonly int[] AccessorsCounts = [ 8 | 10, 9 | 100, 10 | 1_000 11 | ]; 12 | 13 | public IEnumerator GetEnumerator() 14 | { 15 | var serializerTypes = new List { null }; 16 | foreach (var serializerType in Enum.GetValues()) 17 | { 18 | serializerTypes.Add(serializerType); 19 | } 20 | 21 | foreach (var serializerType in serializerTypes) 22 | { 23 | foreach (var memoryLockerType in Enum.GetValues()) 24 | { 25 | foreach (var accessorsCount in AccessorsCounts) 26 | { 27 | yield return [serializerType, memoryLockerType, accessorsCount]; 28 | } 29 | } 30 | } 31 | } 32 | 33 | IEnumerator IEnumerable.GetEnumerator() 34 | { 35 | return GetEnumerator(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/ComplexType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using MemoryPack; 3 | 4 | namespace FusionCacheTests.Stuff; 5 | 6 | [DataContract] 7 | [MemoryPackable] 8 | public partial class ComplexType : IEquatable 9 | { 10 | [DataMember(Name = "pi1", Order = 1)] 11 | public int PropInt { get; set; } 12 | [DataMember(Name = "pi2", Order = 2)] 13 | public int? PropIntNullable { get; set; } 14 | [DataMember(Name = "ps", Order = 3)] 15 | public string? PropString { get; set; } 16 | [DataMember(Name = "pb", Order = 4)] 17 | public bool PropBool { get; set; } 18 | 19 | public override bool Equals(object? obj) 20 | { 21 | return Equals(obj as ComplexType); 22 | } 23 | 24 | public bool Equals(ComplexType? other) 25 | { 26 | return other is not null && 27 | PropInt == other.PropInt && 28 | PropIntNullable == other.PropIntNullable && 29 | PropString == other.PropString && 30 | PropBool == other.PropBool; 31 | } 32 | 33 | public override int GetHashCode() 34 | { 35 | return HashCode.Combine(PropInt, PropIntNullable, PropString, PropBool); 36 | } 37 | 38 | public static bool operator ==(ComplexType? left, ComplexType? right) 39 | { 40 | return EqualityComparer.Default.Equals(left, right); 41 | } 42 | 43 | public static bool operator !=(ComplexType? left, ComplexType? right) 44 | { 45 | return !(left == right); 46 | } 47 | 48 | public static ComplexType CreateSample() 49 | { 50 | return new ComplexType 51 | { 52 | PropInt = 42, 53 | PropIntNullable = null, 54 | PropString = "sloths!", 55 | PropBool = true 56 | }; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/EntryActionKind.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests.Stuff; 2 | 3 | public enum EntryActionKind 4 | { 5 | Miss = 0, 6 | HitNormal = 1, 7 | HitStale = 2, 8 | Set = 3, 9 | Remove = 4, 10 | FailSafeActivate = 5, 11 | FactoryError = 6, 12 | FactorySuccess = 7, 13 | BackplaneMessagePublished = 8, 14 | BackplaneMessageReceived = 9 15 | } 16 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/EntryActionsStats.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | 3 | namespace FusionCacheTests.Stuff; 4 | 5 | public class EntryActionsStats 6 | { 7 | public EntryActionsStats() 8 | { 9 | Data = new ConcurrentDictionary(); 10 | foreach (EntryActionKind kind in Enum.GetValues(typeof(EntryActionKind))) 11 | { 12 | Data[kind] = 0; 13 | } 14 | } 15 | 16 | public ConcurrentDictionary Data { get; } 17 | public void RecordAction(EntryActionKind kind) 18 | { 19 | Data.AddOrUpdate(kind, 1, (_, x) => x + 1); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/FakeHttpEndpoint.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests.Stuff; 2 | 3 | internal class FakeHttpEndpoint 4 | { 5 | public FakeHttpEndpoint(int initialValue) 6 | { 7 | SetValue(initialValue); 8 | } 9 | 10 | private int Value { get; set; } 11 | private string? ETag { get; set; } 12 | 13 | public int TotalRequestsCount { get; private set; } 14 | public int ConditionalRequestsCount { get; private set; } 15 | public int FullResponsesCount { get; private set; } 16 | public int NotModifiedResponsesCount { get; private set; } 17 | 18 | public void SetValue(int value) 19 | { 20 | Value = value; 21 | ETag = Value.GetHashCode().ToString(); 22 | } 23 | 24 | public FakeHttpResponse Get(string? etag = null) 25 | { 26 | TotalRequestsCount++; 27 | 28 | var isRequestWithETag = string.IsNullOrWhiteSpace(etag) == false; 29 | 30 | if (isRequestWithETag) 31 | ConditionalRequestsCount++; 32 | 33 | if (isRequestWithETag == false || etag != ETag) 34 | { 35 | // FULL RESPONSE 36 | FullResponsesCount++; 37 | return new FakeHttpResponse(200, Value, ETag); 38 | } 39 | 40 | // NOT MODIFIED RESPONSE 41 | NotModifiedResponsesCount++; 42 | return new FakeHttpResponse(304, null, ETag); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/FakeHttpResponse.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests.Stuff; 2 | 3 | internal class FakeHttpResponse 4 | { 5 | public FakeHttpResponse(int statusCode, int? content, string? etag = null) 6 | { 7 | StatusCode = statusCode; 8 | Content = content; 9 | ETag = etag; 10 | } 11 | 12 | public int StatusCode { get; set; } 13 | public int? Content { get; set; } 14 | public string? ETag { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/ListLogger.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | namespace FusionCacheTests.Stuff; 4 | 5 | public class ListLogger 6 | : ILogger 7 | { 8 | internal class Scope : IDisposable 9 | { 10 | public void Dispose() 11 | { 12 | // EMPTY 13 | } 14 | } 15 | 16 | private readonly LogLevel _minLogLevel; 17 | public readonly List<(LogLevel LogLevel, string Message)> Items = new(); 18 | 19 | public ListLogger(LogLevel minLogLevel) 20 | { 21 | _minLogLevel = minLogLevel; 22 | } 23 | 24 | public ListLogger() 25 | : this(LogLevel.Trace) 26 | { 27 | // EMPTY 28 | } 29 | 30 | public IDisposable BeginScope(TState state) 31 | where TState : notnull 32 | { 33 | return new Scope(); 34 | } 35 | 36 | public bool IsEnabled(LogLevel logLevel) 37 | { 38 | return logLevel >= _minLogLevel; 39 | } 40 | 41 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) 42 | { 43 | Items.Add((logLevel, formatter(state, exception))); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/MemoryLockerType.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests.Stuff; 2 | 3 | public enum MemoryLockerType 4 | { 5 | // 1ST PARTY 6 | Standard = 0, 7 | //Probabilistic = 1, 8 | //Experimental = 2 9 | 10 | // 3RD PARTY 11 | AsyncKeyed = 10, 12 | StripedAsyncKeyed = 11, 13 | } 14 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/MemoryLockerTypesClassData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace FusionCacheTests.Stuff; 4 | 5 | public class MemoryLockerTypesClassData : IEnumerable 6 | { 7 | public IEnumerator GetEnumerator() 8 | { 9 | foreach (var x in Enum.GetValues()) 10 | { 11 | yield return [x]; 12 | } 13 | } 14 | 15 | IEnumerator IEnumerable.GetEnumerator() 16 | { 17 | return GetEnumerator(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SerializerType.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests.Stuff; 2 | 3 | public enum SerializerType 4 | { 5 | // JSON 6 | NewtonsoftJson = 0, 7 | SystemTextJson = 1, 8 | ServiceStackJson = 2, 9 | // MESSAGEPACK 10 | NeueccMessagePack = 10, 11 | // PROTOBUF 12 | ProtoBufNet = 20, 13 | // MEMORYPACK 14 | CysharpMemoryPack = 30, 15 | } 16 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SerializerTypesClassData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace FusionCacheTests.Stuff; 4 | 5 | public class SerializerTypesClassData : IEnumerable 6 | { 7 | public IEnumerator GetEnumerator() 8 | { 9 | foreach (var x in Enum.GetValues()) 10 | { 11 | yield return [x]; 12 | } 13 | } 14 | 15 | IEnumerator IEnumerable.GetEnumerator() 16 | { 17 | return GetEnumerator(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SimpleDisposable.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests.Stuff; 2 | 3 | internal class SimpleDisposable 4 | : IDisposable 5 | { 6 | 7 | public bool IsDisposed { get; private set; } 8 | 9 | public void Dispose() 10 | { 11 | IsDisposed = true; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SimpleEventsPlugin.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion; 2 | using ZiggyCreatures.Caching.Fusion.Events; 3 | using ZiggyCreatures.Caching.Fusion.Plugins; 4 | 5 | namespace FusionCacheTests.Stuff; 6 | 7 | internal class SimpleEventsPlugin 8 | : IFusionCachePlugin 9 | { 10 | private readonly bool _throwOnStart = false; 11 | private int _missCount = 0; 12 | 13 | public SimpleEventsPlugin(bool throwOnStart = false) 14 | { 15 | _throwOnStart = throwOnStart; 16 | } 17 | 18 | public void Start(IFusionCache cache) 19 | { 20 | IsStarted = true; 21 | 22 | if (_throwOnStart) 23 | throw new Exception("Uooops ¯\\_(ツ)_/¯"); 24 | 25 | cache.Events.Miss += OnMiss; 26 | } 27 | 28 | public void Stop(IFusionCache cache) 29 | { 30 | IsStopped = true; 31 | cache.Events.Miss -= OnMiss; 32 | } 33 | 34 | private void OnMiss(object? sender, FusionCacheEntryEventArgs e) 35 | { 36 | Interlocked.Increment(ref _missCount); 37 | } 38 | 39 | public bool IsStarted { get; private set; } 40 | public bool IsStopped { get; private set; } 41 | 42 | public int MissCount 43 | { 44 | get { return _missCount; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SimpleImmutableObject.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.Serialization; 3 | using MemoryPack; 4 | 5 | namespace FusionCacheTests.Stuff; 6 | 7 | [ImmutableObject(true)] 8 | [DataContract] 9 | [MemoryPackable] 10 | internal sealed partial class SimpleImmutableObject 11 | { 12 | [DataMember(Name = "name", Order = 1)] 13 | public string? Name { get; init; } 14 | [DataMember(Name = "age", Order = 2)] 15 | public int Age { get; init; } 16 | } 17 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SimpleMemoryLocker.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using ZiggyCreatures.Caching.Fusion.Locking; 3 | 4 | namespace FusionCacheTests.Stuff; 5 | 6 | internal class SimpleMemoryLocker 7 | : IFusionCacheMemoryLocker 8 | { 9 | public object? AcquireLock(string cacheName, string cacheInstanceId, string operationId, string key, TimeSpan timeout, ILogger? logger, CancellationToken token) 10 | { 11 | throw new NotImplementedException(); 12 | } 13 | 14 | public ValueTask AcquireLockAsync(string cacheName, string cacheInstanceId, string operationId, string key, TimeSpan timeout, ILogger? logger, CancellationToken token) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | 19 | public void ReleaseLock(string cacheName, string cacheInstanceId, string operationId, string key, object? lockObj, ILogger? logger) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | 24 | public void Dispose() 25 | { 26 | // EMPTY 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SimplePlugin.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion; 2 | using ZiggyCreatures.Caching.Fusion.Plugins; 3 | 4 | namespace FusionCacheTests.Stuff; 5 | 6 | internal class SimplePlugin 7 | : IFusionCachePlugin 8 | { 9 | public SimplePlugin(string name) 10 | { 11 | Name = name; 12 | } 13 | 14 | public string Name { get; } 15 | public bool IsRunning { get; private set; } 16 | 17 | public void Start(IFusionCache cache) 18 | { 19 | IsRunning = true; 20 | } 21 | 22 | public void Stop(IFusionCache cache) 23 | { 24 | IsRunning = false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SimpleServiceKey.cs: -------------------------------------------------------------------------------- 1 | namespace FusionCacheTests.Stuff; 2 | 3 | public record SimpleServiceKey(int value); 4 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SimpleServiceWithKeyedDependency.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using ZiggyCreatures.Caching.Fusion; 3 | 4 | namespace FusionCacheTests.Stuff; 5 | 6 | public class SimpleServiceWithKeyedDependency 7 | { 8 | public SimpleServiceWithKeyedDependency([FromKeyedServices("FooCache")] IFusionCache cache) 9 | { 10 | System.ArgumentNullException.ThrowIfNull(cache); 11 | 12 | Cache = cache; 13 | } 14 | 15 | public IFusionCache Cache { get; } 16 | } 17 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/SyncOnlySerializer.cs: -------------------------------------------------------------------------------- 1 | using ZiggyCreatures.Caching.Fusion.Serialization; 2 | using ZiggyCreatures.Caching.Fusion.Serialization.SystemTextJson; 3 | 4 | namespace FusionCacheTests.Stuff; 5 | 6 | internal class SyncOnlySerializer 7 | : IFusionCacheSerializer 8 | { 9 | private IFusionCacheSerializer _serializer; 10 | 11 | public SyncOnlySerializer() 12 | { 13 | _serializer = new FusionCacheSystemTextJsonSerializer(); 14 | } 15 | 16 | public byte[] Serialize(T? obj) 17 | { 18 | return _serializer.Serialize(obj); 19 | } 20 | 21 | public T? Deserialize(byte[] data) 22 | { 23 | return _serializer.Deserialize(data); 24 | } 25 | 26 | public async ValueTask SerializeAsync(T? obj, CancellationToken token) 27 | { 28 | throw new NotImplementedException(); 29 | } 30 | 31 | public async ValueTask DeserializeAsync(byte[] data, CancellationToken token) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/UnreachableException.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | 4 | #if NET7_0_OR_GREATER == false 5 | 6 | namespace System.Diagnostics 7 | { 8 | /// 9 | /// Exception thrown when the program executes an instruction that was thought to be unreachable. 10 | /// 11 | public sealed class UnreachableException : Exception 12 | { 13 | /// 14 | /// Initializes a new instance of the class with the default error message. 15 | /// 16 | public UnreachableException() 17 | : base("") 18 | { 19 | } 20 | 21 | /// 22 | /// Initializes a new instance of the 23 | /// class with a specified error message. 24 | /// 25 | /// The error message that explains the reason for the exception. 26 | public UnreachableException(string? message) 27 | : base(message) 28 | { 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of the 33 | /// class with a specified error message and a reference to the inner exception that is the cause of 34 | /// this exception. 35 | /// 36 | /// The error message that explains the reason for the exception. 37 | /// The exception that is the cause of the current exception. 38 | public UnreachableException(string? message, Exception? innerException) 39 | : base(message, innerException) 40 | { 41 | } 42 | } 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /tests/ZiggyCreatures.FusionCache.Tests/Stuff/XUnitLogger.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Microsoft.Extensions.Logging; 3 | using Xunit; 4 | 5 | namespace FusionCacheTests.Stuff; 6 | 7 | public class XUnitLogger 8 | : ILogger 9 | { 10 | internal class Scope : IDisposable 11 | { 12 | public void Dispose() 13 | { 14 | // EMPTY 15 | } 16 | } 17 | 18 | private readonly ITestOutputHelper _helper; 19 | private readonly LogLevel _minLogLevel; 20 | 21 | public XUnitLogger(LogLevel minLogLevel, ITestOutputHelper helper) 22 | { 23 | _minLogLevel = minLogLevel; 24 | _helper = helper; 25 | } 26 | 27 | public IDisposable BeginScope(TState state) 28 | where TState : notnull 29 | { 30 | return new Scope(); 31 | } 32 | 33 | public bool IsEnabled(LogLevel logLevel) 34 | { 35 | return logLevel >= _minLogLevel; 36 | } 37 | 38 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) 39 | { 40 | if (IsEnabled(logLevel)) 41 | { 42 | _helper.WriteLine( 43 | (logLevel >= LogLevel.Warning ? Environment.NewLine : "") 44 | + $"{logLevel.ToString()[..4].ToUpper()} {DateTime.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss.fffK", CultureInfo.InvariantCulture)}: " 45 | + formatter(state, exception) 46 | + (exception is null 47 | ? "" 48 | : (Environment.NewLine + exception.ToString() + Environment.NewLine) 49 | ) 50 | + (logLevel >= LogLevel.Warning ? Environment.NewLine : "") 51 | ); 52 | } 53 | } 54 | } 55 | --------------------------------------------------------------------------------