MemoryCacheClient
Assembly: ServiceStack.dll
View Source
public class MemoryCacheClient : ICacheClientExtended, ICacheClient, IDisposable, IRemoveByPattern
Properties
CleaningInterval
View Source
public long CleaningInterval { get; set; }
FlushOnDispose
View Source
public bool FlushOnDispose { get; set; }
Methods
Dispose()
View Source
public void Dispose()
Remove(String)
View Source
public bool Remove(string key)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
RemoveAll(IEnumerable<String>)
View Source
public void RemoveAll(IEnumerable<string> keys)
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | keys |
Get(String)
View Source
public object Get(string key)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | key |
Get(String, out Int64)
View Source
public object Get(string key, out long lastModifiedTicks)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | key |
System.Int64 | lastModifiedTicks |
Get<T>(String)
View Source
public T Get<T>(string key)
Returns
<T>
Parameters
Type | Name |
---|---|
System.String | key |
Type Parameters
T
Increment(String, UInt32)
View Source
public long Increment(string key, uint amount)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | key |
System.UInt32 | amount |
Decrement(String, UInt32)
View Source
public long Decrement(string key, uint amount)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.String | key |
System.UInt32 | amount |
Add<T>(String, T)
Add the value with key to the cache, set to never expire.
View Source
public bool Add<T>(string key, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
Type Parameters
T
Set<T>(String, T)
Add or replace the value with key to the cache, set to never expire.
View Source
public bool Set<T>(string key, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
Type Parameters
T
Replace<T>(String, T)
Replace the value with key in the cache, set to never expire.
View Source
public bool Replace<T>(string key, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
Type Parameters
T
Add<T>(String, T, DateTime)
Add the value with key to the cache, set to expire at specified DateTime.
This method examines the DateTimeKind of expiresAt to determine if conversion to universal time is needed. The version of Add that takes a TimeSpan expiration is faster than using this method with a DateTime of Kind other than Utc, and is not affected by ambiguous local time during daylight savings/standard time transition.
View Source
public bool Add<T>(string key, T value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
Type Parameters
T
Set<T>(String, T, DateTime)
Add or replace the value with key to the cache, set to expire at specified DateTime.
This method examines the DateTimeKind of expiresAt to determine if conversion to universal time is needed. The version of Set that takes a TimeSpan expiration is faster than using this method with a DateTime of Kind other than Utc, and is not affected by ambiguous local time during daylight savings/standard time transition.
View Source
public bool Set<T>(string key, T value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
Type Parameters
T
Replace<T>(String, T, DateTime)
Replace the value with key in the cache, set to expire at specified DateTime.
This method examines the DateTimeKind of expiresAt to determine if conversion to universal time is needed. The version of Replace that takes a TimeSpan expiration is faster than using this method with a DateTime of Kind other than Utc, and is not affected by ambiguous local time during daylight savings/standard time transition.
View Source
public bool Replace<T>(string key, T value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.DateTime | expiresAt |
Type Parameters
T
Add<T>(String, T, TimeSpan)
Add the value with key to the cache, set to expire after specified TimeSpan.
View Source
public bool Add<T>(string key, T value, TimeSpan expiresIn)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
Type Parameters
T
Set<T>(String, T, TimeSpan)
Add or replace the value with key to the cache, set to expire after specified TimeSpan.
View Source
public bool Set<T>(string key, T value, TimeSpan expiresIn)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
Type Parameters
T
Replace<T>(String, T, TimeSpan)
Replace the value with key in the cache, set to expire after specified TimeSpan.
View Source
public bool Replace<T>(string key, T value, TimeSpan expiresIn)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
<T> | value |
System.TimeSpan | expiresIn |
Type Parameters
T
FlushAll()
View Source
public void FlushAll()
GetAll<T>(IEnumerable<String>)
View Source
public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys)
Returns
System.Collections.Generic.IDictionary<System.String,<T>>
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | keys |
Type Parameters
T
SetAll<T>(IDictionary<String, T>)
View Source
public void SetAll<T>(IDictionary<string, T> values)
Parameters
Type | Name |
---|---|
System.Collections.Generic.IDictionary<System.String,<T>> | values |
Type Parameters
T
RemoveByPattern(String)
View Source
public void RemoveByPattern(string pattern)
Parameters
Type | Name |
---|---|
System.String | pattern |
RemoveByRegex(String)
View Source
public void RemoveByRegex(string pattern)
Parameters
Type | Name |
---|---|
System.String | pattern |
GetKeysByPattern(String)
View Source
public IEnumerable<string> GetKeysByPattern(string pattern)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|---|
System.String | pattern |
GetKeysByRegex(String)
View Source
public List<string> GetKeysByRegex(string pattern)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.String | pattern |
RemoveExpiredEntries()
View Source
public void RemoveExpiredEntries()
GetTimeToLive(String)
View Source
public TimeSpan? GetTimeToLive(string key)
Returns
System.Nullable<System.TimeSpan>
Parameters
Type | Name |
---|---|
System.String | key |