Interface IObjectStore
Outlines interface for object stores. Object stores are special kind of zero-latency storage of application state
which needs to be persisted between application/process restart (hence the name "volatile process") with expiration.
For example, an app may keep user session context (or any other call context)in this store to ensure the survival
of these contexts between volatile app lifecycle.
Azos framework provides an abstraction of store "providers" which store objects in
files, database or other media. The usage of Object stores unifies the access to such data.
Object stores are by-design expected to be in-memory/fast, therefore they do not expose ASYNC apis.
The writing of objects to persistent media (such as disk) is expected to be done asynchronously by other thread/s
Assembly: Azos.dll
Syntax
public interface IObjectStore : IApplicationComponent, ILocalizedTimeProvider
Properties
ObjectLifeSpanMS
Specifies how long objects live without being touched before becoming evicted from the store
Declaration
int ObjectLifeSpanMS { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
CheckIn(Guid, Int32)
Puts an object into store identified by the "key"
Declaration
bool CheckIn(Guid key, int msTimeout = 0)
Parameters
Type |
Name |
Description |
System.Guid |
key |
|
System.Int32 |
msTimeout |
|
Returns
Type |
Description |
System.Boolean |
|
CheckIn(Guid, Object, Int32)
Puts an object reference "value" into store identified by the "key"
Declaration
void CheckIn(Guid key, object value, int msTimeout = 0)
Parameters
Type |
Name |
Description |
System.Guid |
key |
|
System.Object |
value |
|
System.Int32 |
msTimeout |
|
CheckInUnderNewKey(Guid, Guid, Object, Int32)
Puts an object reference "value" into store identified by the "oldKey" under the "newKey".
If oldKey was not checked in, then checks-in under new key as normally would
Declaration
void CheckInUnderNewKey(Guid oldKey, Guid newKey, object value, int msTimeout = 0)
Parameters
Type |
Name |
Description |
System.Guid |
oldKey |
|
System.Guid |
newKey |
|
System.Object |
value |
|
System.Int32 |
msTimeout |
|
CheckOut(Guid)
Retrieves an object reference from the store identified by the "key" or returns null if such object does not exist.
Object is not going to be persisted until it is checked back in the store.
Declaration
object CheckOut(Guid key)
Parameters
Type |
Name |
Description |
System.Guid |
key |
|
Returns
Type |
Description |
System.Object |
|
Delete(Guid)
Deletes object identified by key. Returns true when object was found and marked for deletion
Declaration
Parameters
Type |
Name |
Description |
System.Guid |
key |
|
Returns
Type |
Description |
System.Boolean |
|
Fetch(Guid, Boolean)
Retrieves an object reference from the store identified by the "key" or returns null if such object does not exist.
Object is not going to be persisted as this method provides logical read-only access. If touch=true then object timestamp is updated
Declaration
object Fetch(Guid key, bool touch = false)
Parameters
Type |
Name |
Description |
System.Guid |
key |
|
System.Boolean |
touch |
|
Returns
Type |
Description |
System.Object |
|
UndoCheckout(Guid)
Reverts object state to Normal after the call to Checkout. This way the changes (if any) are not going to be persisted.
Returns true if object was found and checkout canceled. Keep in mind: this method CAN NOT revert inner object state
to its original state if it was changed, it only unmarks object as changed.
This method is reentrant just like the Checkout is
Declaration
bool UndoCheckout(Guid key)
Parameters
Type |
Name |
Description |
System.Guid |
key |
|
Returns
Type |
Description |
System.Boolean |
|
Extension Methods