Skip to main content

MemoryCacheClient

Assembly: ServiceStack.dll
View Source
Declaration
public class MemoryCacheClient : ICacheClientExtended, ICacheClient, IDisposable, IRemoveByPattern

Properties

CleaningInterval

View Source
Declaration
public long CleaningInterval { get; set; }

FlushOnDispose

View Source
Declaration
public bool FlushOnDispose { get; set; }

Methods

Dispose()

View Source
Declaration
public void Dispose()

Remove(String)

View Source
Declaration
public bool Remove(string key)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey

RemoveAll(IEnumerable<String>)

View Source
Declaration
public void RemoveAll(IEnumerable<string> keys)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>keys

Get(String)

View Source
Declaration
public object Get(string key)
Returns

System.Object

Parameters
TypeName
System.Stringkey

Get(String, out Int64)

View Source
Declaration
public object Get(string key, out long lastModifiedTicks)
Returns

System.Object

Parameters
TypeName
System.Stringkey
System.Int64lastModifiedTicks

Get<T>(String)

View Source
Declaration
public T Get<T>(string key)
Returns

<T>

Parameters
TypeName
System.Stringkey
Type Parameters
  • T

Increment(String, UInt32)

View Source
Declaration
public long Increment(string key, uint amount)
Returns

System.Int64

Parameters
TypeName
System.Stringkey
System.UInt32amount

Decrement(String, UInt32)

View Source
Declaration
public long Decrement(string key, uint amount)
Returns

System.Int64

Parameters
TypeName
System.Stringkey
System.UInt32amount

Add<T>(String, T)

Add the value with key to the cache, set to never expire.

View Source
Declaration
public bool Add<T>(string key, T value)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<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
Declaration
public bool Set<T>(string key, T value)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
Type Parameters
  • T

Replace<T>(String, T)

Replace the value with key in the cache, set to never expire.

View Source
Declaration
public bool Replace<T>(string key, T value)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<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
Declaration
public bool Add<T>(string key, T value, DateTime expiresAt)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
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
Declaration
public bool Set<T>(string key, T value, DateTime expiresAt)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
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
Declaration
public bool Replace<T>(string key, T value, DateTime expiresAt)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.DateTimeexpiresAt
Type Parameters
  • T

Add<T>(String, T, TimeSpan)

Add the value with key to the cache, set to expire after specified TimeSpan.

View Source
Declaration
public bool Add<T>(string key, T value, TimeSpan expiresIn)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
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
Declaration
public bool Set<T>(string key, T value, TimeSpan expiresIn)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
Type Parameters
  • T

Replace<T>(String, T, TimeSpan)

Replace the value with key in the cache, set to expire after specified TimeSpan.

View Source
Declaration
public bool Replace<T>(string key, T value, TimeSpan expiresIn)
Returns

System.Boolean

Parameters
TypeName
System.Stringkey
<T>value
System.TimeSpanexpiresIn
Type Parameters
  • T

FlushAll()

View Source
Declaration
public void FlushAll()

GetAll<T>(IEnumerable<String>)

View Source
Declaration
public IDictionary<string, T> GetAll<T>(IEnumerable<string> keys)
Returns

System.Collections.Generic.IDictionary<System.String,<T>>

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>keys
Type Parameters
  • T

SetAll<T>(IDictionary<String, T>)

View Source
Declaration
public void SetAll<T>(IDictionary<string, T> values)
Parameters
TypeName
System.Collections.Generic.IDictionary<System.String,<T>>values
Type Parameters
  • T

RemoveByPattern(String)

View Source
Declaration
public void RemoveByPattern(string pattern)
Parameters
TypeName
System.Stringpattern

RemoveByRegex(String)

View Source
Declaration
public void RemoveByRegex(string pattern)
Parameters
TypeName
System.Stringpattern

GetKeysByPattern(String)

View Source
Declaration
public IEnumerable<string> GetKeysByPattern(string pattern)
Returns

System.Collections.Generic.IEnumerable<System.String>

Parameters
TypeName
System.Stringpattern

GetKeysByRegex(String)

View Source
Declaration
public List<string> GetKeysByRegex(string pattern)
Returns

System.Collections.Generic.List<System.String>

Parameters
TypeName
System.Stringpattern

RemoveExpiredEntries()

View Source
Declaration
public void RemoveExpiredEntries()

GetTimeToLive(String)

View Source
Declaration
public TimeSpan? GetTimeToLive(string key)
Returns

System.Nullable<System.TimeSpan>

Parameters
TypeName
System.Stringkey

Implements