IMemcachedClient
A light interface over a cache client. This interface was inspired by Enyim.Caching.MemcachedClient
Only the methods that are intended to be used are required, if you require extra functionality you can uncomment the unused methods below as they have been implemented in DdnMemcachedClient
Assembly: ServiceStack.Interfaces.dll
View Source
public interface IMemcachedClient : IDisposable
Methods
Remove(String)
Removes the specified item from the cache.
View Source
bool Remove(string key)
Returns
System.Boolean
:
true if the item was successfully removed from the cache; false otherwise.
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The identifier for the item to delete. |
|
RemoveAll(IEnumerable<String>)
Removes the cache for all the keys provided.
View Source
void RemoveAll(IEnumerable<string> keys)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | keys | The keys. |
|
Get(String)
Retrieves the specified item from the cache.
View Source
object Get(string key)
Returns
System.Object
:
The retrieved item, or <returns>null</returns> if the key was not found.
Parameters
Type | Name |
---|---|
System.String | key |
Get(String, out UInt64)
View Source
object Get(string key, out ulong lastModifiedValue)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | key |
System.UInt64 | lastModifiedValue |
Increment(String, UInt32)
Increments the value of the specified key by the given amount. The operation is atomic and happens on the server.
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
View Source
long Increment(string key, uint amount)
Returns
System.Int64
:
The new value of the item or -1 if not found.
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The identifier for the item to increment. |
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
|
| System.UInt32
| amount | The amount by which the client wants to increase the item.
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
|
Decrement(String, UInt32)
Increments the value of the specified key by the given amount. The operation is atomic and happens on the server.
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
View Source
long Decrement(string key, uint amount)
Returns
System.Int64
:
The new value of the item or -1 if not found.
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The identifier for the item to increment. |
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
|
| System.UInt32
| amount | The amount by which the client wants to decrease the item.
The item must be inserted into the cache before it can be changed. The item must be inserted as a <xref href="System.String" data-throw-if-not-resolved="false"></xref>. The operation only works with <xref href="System.UInt32" data-throw-if-not-resolved="false"></xref> values, so -1 always indicates that the item was not found.
|
Add(String, Object)
Inserts an item into the cache with a cache key to reference its location.
The item does not expire unless it is removed due memory pressure.
View Source
bool Add(string key, object value)
Returns
System.Boolean
:
true if the item was successfully stored in the cache; false otherwise.
The item does not expire unless it is removed due memory pressure.
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key used to reference the item. |
The item does not expire unless it is removed due memory pressure.
|
| System.Object
| value | The object to be inserted into the cache.
The item does not expire unless it is removed due memory pressure.
|
Set(String, Object)
View Source
bool Set(string key, object value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
System.Object | value |
Replace(String, Object)
View Source
bool Replace(string key, object value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
System.Object | value |
Add(String, Object, DateTime)
Inserts an item into the cache with a cache key to reference its location.
View Source
bool Add(string key, object value, DateTime expiresAt)
Returns
System.Boolean
: true if the item was successfully stored in the cache; false otherwise.
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key used to reference the item. |
|
| System.Object
| value | The object to be inserted into the cache.
|
| System.DateTime
| expiresAt | The time when the item is invalidated in the cache.
|
Set(String, Object, DateTime)
View Source
bool Set(string key, object value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
System.Object | value |
System.DateTime | expiresAt |
Replace(String, Object, DateTime)
View Source
bool Replace(string key, object value, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
System.Object | value |
System.DateTime | expiresAt |
FlushAll()
Removes all data from the cache.
View Source
void FlushAll()
GetAll(IEnumerable<String>)
Retrieves multiple items from the cache.
View Source
IDictionary<string, object> GetAll(IEnumerable<string> keys)
Returns
System.Collections.Generic.IDictionary<System.String,System.Object>
:
a Dictionary holding all items indexed by their key.
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | keys | The list of identifiers for the items to retrieve. |
|
CheckAndSet(String, Object, UInt64)
View Source
bool CheckAndSet(string key, object value, ulong lastModifiedValue)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
System.Object | value |
System.UInt64 | lastModifiedValue |
CheckAndSet(String, Object, UInt64, DateTime)
View Source
bool CheckAndSet(string key, object value, ulong lastModifiedValue, DateTime expiresAt)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.String | key |
System.Object | value |
System.UInt64 | lastModifiedValue |
System.DateTime | expiresAt |
GetAll(IEnumerable<String>, out IDictionary<String, UInt64>)
View Source
IDictionary<string, object> GetAll(IEnumerable<string> keys, out IDictionary<string, ulong> lastModifiedValues)
Returns
System.Collections.Generic.IDictionary<System.String,System.Object>
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.String> | keys |
System.Collections.Generic.IDictionary<System.String,System.UInt64> | lastModifiedValues |