Repository navigation
The repository has no issues yet; these are the questions the README, the source and the verification for this wiki raised.
Check these, in this order:
-
[Cache]is on the class's method, not only on the interface. - The component is registered with
EnableCacheInterception()and resolved as its interface. - The call comes through the proxy, not from inside the class.
- The lifetime is above zero.
- The method does not return
voidorValueTask. - Every argument can be written into a key.
Errors and edge cases shows each case with its output.
Yes. The key starts with the instance's ToString(), which by default is the type name, so every instance of a class shares entries, across containers too. Override ToString() to keep them apart (How results are cached).
Yes, with RegisterCachingModule(): the store is MemoryCache.Default, which lives as long as the process. Register a MemoryCacheService over a MemoryCache of your own to tie the store to the container (Recipes).
The package has no remove method. An entry leaves when its lifetime ends. For a value you cache by key, Set with the same key replaces it (Recipes). For tests, give each test its own store.
No. An entry expires a fixed time after it was stored, however often it is read (How results are cached shows a three-second entry expiring after reads at 1 and 2 seconds).
With the same key, one runs the method and the others wait for its result. With different keys they run in parallel (How results are cached). 1.0.1 ran the method once per caller.
A method returning Task or Task<T> is cached as its task, and a task that fails or is cancelled is dropped. A method returning ValueTask is not cached (How results are cached).
Autofac 6.5.0 and 9.3.4 were run for this wiki, with Autofac.Extras.DynamicProxy 7.1.0 and 8.1.0 and Castle.Core 5.1.1 and 5.2.1 (Getting started). The README says Autofac 6.5 to 9; the versions between the two ends were not run here. The repository's CI runs the same three sets against every build.
.NET Framework 4.8, .NET 8 and .NET 10 were run on Windows 11, and .NET 10 on Ubuntu 26.04 in WSL. The answers were the same everywhere; only .NET Framework words some exception messages differently (Getting started). The package says .NET Framework 4.6.2 and later; versions before 4.8 were not run.
No. Entries live in the memory of one process. Nothing is shared between processes or servers, and nothing is written to disk.
The README advises against it for new code that does not use Autofac: IMemoryCache or HybridCache fit there. Its place is an application already built on Autofac that wants method results cached with an attribute.
No. It reads and writes process memory only.
The package id has been CachingServiceWithAOPSupport since 2015, and the assembly and namespaces CachingServiceWithAOP. 2.0.0 kept both so that 1.0.1 code compiles unchanged.
Not tested.
Only with care. The key is built from the arguments and the instance's ToString(), so two users who make the same call get the same entry. Put what tells them apart in the arguments or in ToString(), or do not cache such results.
This wiki describes CachingServiceWithAOPSupport 2.0.0 and was last updated on 2026-09-30. The library is MIT licensed. Report problems in the issues. On NuGet: CachingServiceWithAOPSupport.