Interface IBlobCache
- Namespace
- Akavache
- Assembly
- Akavache.Core.dll
IBlobCache is the core interface on which Akavache is built, it is an interface describing an asynchronous persistent key-value store.
public interface IBlobCache : IDisposable
- Inherited Members
- Extension Methods
Properties
ForcedDateTimeKind
Gets or sets the DateTimeKind handling for BSON readers to be forced.
DateTimeKind? ForcedDateTimeKind { get; set; }
Property Value
Remarks
By default, Newtonsoft.Json.Bson.BsonReader uses a DateTimeKind of Local and Newtonsoft.Json.Bson.BsonWriter
uses Utc. Thus, DateTimes are serialized as UTC but deserialized as local time. To force BSON readers to
use some other DateTimeKind
, you can set this value.
Scheduler
Gets the IScheduler used to defer operations. By default, this is BlobCache.TaskpoolScheduler.
IScheduler Scheduler { get; }
Property Value
- IScheduler
Shutdown
Gets an Observable that fires after the Dispose completes successfully, since there is no such thing as an AsyncDispose().
IObservable<Unit> Shutdown { get; }
Property Value
- IObservable<Unit>
Methods
Flush()
This method guarantees that all in-flight inserts have completed and any indexes have been written to disk.
IObservable<Unit> Flush()
Returns
- IObservable<Unit>
A signal indicating when the flush is complete.
Get(string)
Retrieve a value from the key-value cache. If the key is not in the cache, this method should return an IObservable which OnError's with KeyNotFoundException.
IObservable<byte[]> Get(string key)
Parameters
key
stringThe key to return asynchronously.
Returns
- IObservable<byte[]>
A Future result representing the byte data.
GetAllKeys()
Return all keys in the cache. Note that this method is normally for diagnostic / testing purposes, and that it is not guaranteed to be accurate with respect to in-flight requests.
IObservable<IEnumerable<string>> GetAllKeys()
Returns
- IObservable<IEnumerable<string>>
A list of valid keys for the cache.
GetCreatedAt(string)
Returns the time that the key was added to the cache, or returns null if the key isn't in the cache.
IObservable<DateTimeOffset?> GetCreatedAt(string key)
Parameters
key
stringThe key to return the date for.
Returns
- IObservable<DateTimeOffset?>
The date the key was created on.
Insert(string, byte[], DateTimeOffset?)
Insert a blob into the cache with the specified key and expiration date.
IObservable<Unit> Insert(string key, byte[] data, DateTimeOffset? absoluteExpiration = null)
Parameters
key
stringThe key to use for the data.
data
byte[]The data to save in the cache.
absoluteExpiration
DateTimeOffset?An optional expiration date. After the specified date, the key-value pair should be removed.
Returns
- IObservable<Unit>
A signal to indicate when the key has been inserted.
Invalidate(string)
Remove a key from the cache. If the key doesn't exist, this method should do nothing and return (not throw KeyNotFoundException).
IObservable<Unit> Invalidate(string key)
Parameters
key
stringThe key to remove from the cache.
Returns
- IObservable<Unit>
A signal indicating when the invalidate is complete.
InvalidateAll()
Invalidate all entries in the cache (i.e. clear it). Note that this method is blocking and incurs a significant performance penalty if used while the cache is being used on other threads.
IObservable<Unit> InvalidateAll()
Returns
- IObservable<Unit>
A signal indicating when the invalidate is complete.
Vacuum()
This method eagerly removes all expired keys from the blob cache, as well as does any cleanup operations that makes sense (Hint: on SQLite3 it does a Vacuum).
IObservable<Unit> Vacuum()
Returns
- IObservable<Unit>
A signal indicating when the operation is complete.