Fast.Cache public API
Targets: net8.0;net9.0;net10.0. This is a declaration and XML-comment reference. See the module guide for usage and constraints.
Source commit: 43554c07f6c216f80b509bd535c0a5b66ae7f2e8. Maintained through scripts/export-dotnet-api.ps1 -Language en; ordinary site builds consume this file directly.
Fast.Cache.DefaultCacheContextLocator
Source · Targets: net8.0, net9.0, net10.0
[SuppressSniffer]
public class DefaultCacheContextLocator : ICacheContextLocatorDefault cache context locator
Fast.Cache.DefaultCacheContextLocator.ServiceName
Source · Targets: net8.0, net9.0, net10.0
public string ServiceName { get; }Documentation is inherited from an interface or base class; consult that declaration.
Fast.Cache.ICacheContextLocator
Source · Targets: net8.0, net9.0, net10.0
[SuppressSniffer]
public interface ICacheContextLocatorCache context locator
Fast.Cache.ICacheContextLocator.ServiceName
Source · Targets: net8.0, net9.0, net10.0
public string ServiceName { get; }Service name
Fast.Cache.IServiceCollectionExtension
Source · Targets: net8.0, net9.0, net10.0
[SuppressSniffer]
public static class IServiceCollectionExtensionCache extensions for IServiceCollection
Fast.Cache.IServiceCollectionExtension.AddCache
Source · Targets: net8.0, net9.0, net10.0
public static IServiceCollection AddCache(this IServiceCollection services, string section = "RedisSettings")Adds cache services
- Parameter
services: The service collection to add services to - Parameter
section: JSON configuration section key; defaults to RedisSettings - Returns: Returns
servicesfor chaining
Fast.Cache.IServiceCollectionExtension.AddCache
Source · Targets: net8.0, net9.0, net10.0
public static IServiceCollection AddCache(this IServiceCollection services, Action<RedisSettingsOptions> optionAction)Adds cache services
- Parameter
services: The service collection to add services to - Parameter
optionAction: Redis configuration callback - Returns: Returns
servicesfor chaining
Fast.Cache.ICache
Source · Targets: net8.0, net9.0, net10.0
public interface ICache : ICache<DefaultCacheContextLocator>Default cache service
Fast.Cache.ICache
Source · Targets: net8.0, net9.0, net10.0
public interface ICache<out CacheContextLocator> where CacheContextLocator : ICacheContextLocator, new()Cache service
- Type parameter
CacheContextLocator: Cache context locator type used to isolate cache configurations
Fast.Cache.ICache.Prefix
Source · Targets: net8.0, net9.0, net10.0
public string Prefix { get; }Prefix
Fast.Cache.ICache.Client
Source · Targets: net8.0, net9.0, net10.0
CSRedisClient Client { get; }CSRedis cache client
Fast.Cache.ICache.ContextLocator
Source · Targets: net8.0, net9.0, net10.0
CacheContextLocator ContextLocator { get; }Cache context locator
Fast.Cache.ICache.Del
Source · Targets: net8.0, net9.0, net10.0
long Del(params string[] key);Deletes cache entries for the specified keys
- Parameter
key: Cache key - Returns: The number of entries actually deleted
Fast.Cache.ICache.DelAsync
Source · Targets: net8.0, net9.0, net10.0
Task<long> DelAsync(params string[] key);Asynchronously deletes cache entries for the specified keys
- Parameter
key: Cache key - Returns: A task whose result is the number of cache entries actually deleted
Fast.Cache.ICache.DelByPattern
Source · Targets: net8.0, net9.0, net10.0
long DelByPattern(string pattern);Deletes all cache entries matching a pattern
Remarks: Scans and deletes all matching keys. A large key set may block Redis; avoid calling this on high-traffic paths.
- Parameter
pattern: Pattern used to match target entries - Returns: The number of entries actually deleted
Fast.Cache.ICache.DelByPatternAsync
Source · Targets: net8.0, net9.0, net10.0
Task<long> DelByPatternAsync(string pattern);Asynchronously deletes all cache entries matching a pattern
Remarks: Scans and deletes all matching keys. A large key set may block Redis; avoid calling this on high-traffic paths.
- Parameter
pattern: Pattern used to match target entries - Returns: A task whose result is the number of matching cache entries actually deleted
Fast.Cache.ICache.Exists
Source · Targets: net8.0, net9.0, net10.0
bool Exists(string key);Checks whether the specified cache key exists
- Parameter
key: Cache key - Returns: Returns
truewhen the condition is met; otherwisefalse
Fast.Cache.ICache.ExistsAsync
Source · Targets: net8.0, net9.0, net10.0
Task<bool> ExistsAsync(string key);Asynchronously checks whether the specified cache key exists
- Parameter
key: Cache key - Returns: Returns
truewhen the condition is met; otherwisefalse
Fast.Cache.ICache.Get
Source · Targets: net8.0, net9.0, net10.0
string Get(string key);Gets the cached value for the specified key
- Parameter
key: Cache key - Returns: The retrieved cache value
Fast.Cache.ICache.Get
Source · Targets: net8.0, net9.0, net10.0
T Get<T>(string key);Gets the cached value for the specified key
- Parameter
key: Cache key - Type parameter
T: Type of the cached value - Returns: The retrieved cache value
Fast.Cache.ICache.GetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<string> GetAsync(string key);Asynchronously gets the cached value for the specified key
- Parameter
key: Cache key - Returns: A task whose result is the retrieved cache value
Fast.Cache.ICache.GetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<T> GetAsync<T>(string key);Asynchronously gets the cached value for the specified key
- Parameter
key: Cache key - Type parameter
T: Type of the cached value - Returns: A task whose result is the retrieved cache value
Fast.Cache.ICache.Set
Source · Targets: net8.0, net9.0, net10.0
bool Set(string key, object value);Stores a value under the specified cache key
- Parameter
key: Cache key - Parameter
value: Value to cache - Returns: Returns
truewhen the cache write succeeds; otherwisefalse
Fast.Cache.ICache.Set
Source · Targets: net8.0, net9.0, net10.0
bool Set(string key, object value, int expireSeconds);Stores a value under the specified cache key
- Parameter
key: Cache key - Parameter
value: Value to cache - Parameter
expireSeconds: Lifetime in seconds - Returns: Returns
truewhen the cache write succeeds; otherwisefalse
Fast.Cache.ICache.Set
Source · Targets: net8.0, net9.0, net10.0
bool Set(string key, object value, TimeSpan expireTimeSpan);Stores a value under the specified cache key
- Parameter
key: Cache key - Parameter
value: Value to cache - Parameter
expireTimeSpan: Lifetime - Returns: Returns
truewhen the cache write succeeds; otherwisefalse
Fast.Cache.ICache.SetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<bool> SetAsync(string key, object value);Asynchronously stores a value under the specified cache key
- Parameter
key: Cache key - Parameter
value: Value to cache - Returns: Returns
truewhen the cache write succeeds; otherwisefalse
Fast.Cache.ICache.SetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<bool> SetAsync(string key, object value, int expireSeconds);Asynchronously stores a value under the specified cache key
- Parameter
key: Cache key - Parameter
value: Value to cache - Parameter
expireSeconds: Lifetime in seconds - Returns: Returns
truewhen the cache write succeeds; otherwisefalse
Fast.Cache.ICache.SetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<bool> SetAsync(string key, object value, TimeSpan expireTimeSpan);Asynchronously stores a value under the specified cache key
- Parameter
key: Cache key - Parameter
value: Value to cache - Parameter
expireTimeSpan: Lifetime - Returns: Returns
truewhen the cache write succeeds; otherwisefalse
Fast.Cache.ICache.GetAllKeys
Source · Targets: net8.0, net9.0, net10.0
List<string> GetAllKeys();Gets all cache keys in the current Redis database
Remarks: Scans the database keys and can be expensive for large key sets. Do not call this on high-frequency request paths.
- Returns: The collection of cache keys in the current Redis database
Fast.Cache.ICache.GetAllKeysAsync
Source · Targets: net8.0, net9.0, net10.0
Task<List<string>> GetAllKeysAsync();Asynchronously gets all cache keys in the current Redis database
Remarks: Scans the database keys and can be expensive for large key sets. Do not call this on high-frequency request paths.
- Returns: A task whose result is the collection of cache keys in the current Redis database
Fast.Cache.ICache.GetAndSet
Source · Targets: net8.0, net9.0, net10.0
string GetAndSet(string key, Func<string> func);Gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
func: Delegate that creates and stores a value on a cache miss - Returns: The cached value, or the new value created and stored by the factory on a cache miss
Fast.Cache.ICache.GetAndSet
Source · Targets: net8.0, net9.0, net10.0
T GetAndSet<T>(string key, Func<T> func);Gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
func: Delegate that creates and stores a value on a cache miss - Type parameter
T: Type of the cached value - Returns: The cached value, or the new value created and stored by the factory on a cache miss
Fast.Cache.ICache.GetAndSet
Source · Targets: net8.0, net9.0, net10.0
string GetAndSet(string key, int expireSeconds, Func<string> func);Gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireSeconds: Lifetime in seconds - Parameter
func: Delegate that creates and stores a value on a cache miss - Returns: The cached value, or the new value created and stored by the factory on a cache miss
Fast.Cache.ICache.GetAndSet
Source · Targets: net8.0, net9.0, net10.0
T GetAndSet<T>(string key, int expireSeconds, Func<T> func);Gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireSeconds: Lifetime in seconds - Parameter
func: Delegate that creates and stores a value on a cache miss - Type parameter
T: Type of the cached value - Returns: The cached value, or the new value created and stored by the factory on a cache miss
Fast.Cache.ICache.GetAndSet
Source · Targets: net8.0, net9.0, net10.0
string GetAndSet(string key, TimeSpan expireTimeSpan, Func<string> func);Gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireTimeSpan: Lifetime - Parameter
func: Delegate that creates and stores a value on a cache miss - Returns: The cached value, or the new value created and stored by the factory on a cache miss
Fast.Cache.ICache.GetAndSet
Source · Targets: net8.0, net9.0, net10.0
T GetAndSet<T>(string key, TimeSpan expireTimeSpan, Func<T> func);Gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireTimeSpan: Lifetime - Parameter
func: Delegate that creates and stores a value on a cache miss - Type parameter
T: Type of the cached value - Returns: The cached value, or the new value created and stored by the factory on a cache miss
Fast.Cache.ICache.GetAndSetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<string> GetAndSetAsync(string key, Func<Task<string>> func);Asynchronously gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
func: Delegate that creates and stores a value on a cache miss - Returns: A task whose result is the cached value or the value created and stored by the factory on a miss
Fast.Cache.ICache.GetAndSetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<T> GetAndSetAsync<T>(string key, Func<Task<T>> func);Asynchronously gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
func: Delegate that creates and stores a value on a cache miss - Type parameter
T: Type of the cached value - Returns: A task whose result is the cached value or the value created and stored by the factory on a miss
Fast.Cache.ICache.GetAndSetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<string> GetAndSetAsync(string key, int expireSeconds, Func<Task<string>> func);Asynchronously gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireSeconds: Lifetime in seconds - Parameter
func: Delegate that asynchronously creates a value when the cache entry is missing - Returns: A task whose result is the cached value or the value created and stored by the factory on a miss
Fast.Cache.ICache.GetAndSetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<T> GetAndSetAsync<T>(string key, int expireSeconds, Func<Task<T>> func);Asynchronously gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireSeconds: Lifetime in seconds - Parameter
func: Delegate that asynchronously creates a value when the cache entry is missing - Type parameter
T: Type of the cached value - Returns: A task whose result is the cached value or the value created and stored by the factory on a miss
Fast.Cache.ICache.GetAndSetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<string> GetAndSetAsync(string key, TimeSpan expireTimeSpan, Func<Task<string>> func);Asynchronously gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireTimeSpan: Lifetime - Parameter
func: Delegate that creates and stores a value on a cache miss - Returns: A task whose result is the cached value or the value created and stored by the factory on a miss
Fast.Cache.ICache.GetAndSetAsync
Source · Targets: net8.0, net9.0, net10.0
Task<T> GetAndSetAsync<T>(string key, TimeSpan expireTimeSpan, Func<Task<T>> func);Asynchronously gets a cached value, or creates and stores a new value on a cache miss
- Parameter
key: Cache key - Parameter
expireTimeSpan: Lifetime - Parameter
func: Delegate that creates and stores a value on a cache miss - Type parameter
T: Type of the cached value - Returns: A task whose result is the cached value or the value created and stored by the factory on a miss
Fast.Cache.RedisSettingsOptions
Source · Targets: net8.0, net9.0, net10.0
[SuppressSniffer]
public class RedisSettingsOptions : IPostConfigureRedis connection string configuration
Fast.Cache.RedisSettingsOptions.ServiceIp
Source · Targets: net8.0, net9.0, net10.0
public string ServiceIp { get; set; }Server IP address
Fast.Cache.RedisSettingsOptions.Port
Source · Targets: net8.0, net9.0, net10.0
public int? Port { get; set; }Port number
Fast.Cache.RedisSettingsOptions.DbName
Source · Targets: net8.0, net9.0, net10.0
public int? DbName { get; set; }Default database
Fast.Cache.RedisSettingsOptions.DbPwd
Source · Targets: net8.0, net9.0, net10.0
public string DbPwd { get; set; }Password
Fast.Cache.RedisSettingsOptions.Prefix
Source · Targets: net8.0, net9.0, net10.0
public string Prefix { get; set; }Prefix
Fast.Cache.RedisSettingsOptions.Poolsize
Source · Targets: net8.0, net9.0, net10.0
public int? Poolsize { get; set; }Connection pool size
Fast.Cache.RedisSettingsOptions.SSL
Source · Targets: net8.0, net9.0, net10.0
public bool? SSL { get; set; }SSL encrypted connection
Fast.Cache.RedisSettingsOptions.Services
Source · Targets: net8.0, net9.0, net10.0
public List<RedisServiceSettingsOptions> Services { get; set; }Services
Fast.Cache.RedisSettingsOptions.PostConfigure
Source · Targets: net8.0, net9.0, net10.0
public void PostConfigure()Documentation is inherited from an interface or base class; consult that declaration.
Fast.Cache.RedisServiceSettingsOptions
Source · Targets: net8.0, net9.0, net10.0
[SuppressSniffer]
public class RedisServiceSettingsOptions : RedisSettingsOptionsRedis connection service configuration
Fast.Cache.RedisServiceSettingsOptions.ServiceName
Source · Targets: net8.0, net9.0, net10.0
public string ServiceName { get; set; }Service name
