
API for cache persistent storage for read-through and write-through behavior. More...
Inherited by GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
Public Member Functions | |
| void | LoadCache (Action< object, object > act, params object[] args) |
| Loads all values from underlying persistent storage. Note that keys are not passed, so it is up to implementation to figure out what to load. This method is called whenever ICache<K,V>.LocalLoadCache method is invoked which is usually to preload the cache from persistent storage. This method is optional, and cache implementation does not depend on this method to do anything. For every loaded value method provided action should be called. The action will then make sure that the loaded value is stored in cache. More... | |
| object | Load (object key) |
| Loads an object. Application developers should implement this method to customize the loading of a value for a cache entry. This method is called by a cache when a requested entry is not in the cache. If the object can't be loaded More... | |
| IDictionary | LoadAll (ICollection keys) |
| Loads multiple objects. Application developers should implement this method to customize the loading of cache entries. This method is called when the requested object is not in the cache. If an object can't be loaded, it is not returned in the resulting map. More... | |
| void | Write (object key, object val) |
| Write the specified value under the specified key to the external resource. More... | |
| void | WriteAll (IDictionary entries) |
| Write the specified entries to the external resource. This method is intended to support both insert and update. More... | |
| void | Delete (object key) |
| Delete the cache entry from the external resource. More... | |
| void | DeleteAll (ICollection keys) |
| Remove data and keys from the external resource for the given collection of keys, if present. More... | |
| void | SessionEnd (bool commit) |
Tells store to commit or rollback a transaction depending on the value of the commit parameter. More... | |
Persistent store is configured in GridGain's Spring XML configuration file via CacheConfiguration.setStore() property. If you have an implementation of cache store in .NET, you should use special Java wrapper which accepts assembly name and class name of .NET store implementation (both properties are mandatory).
Optionally, you may specify "properies" property to set any property values on an instance of your store.
Here is an example:
Assemply name and class name are passed to System.Activator.CreateInstance(String, String) method during node startup to create an instance of cache store. Refer to its documentation for details.
All transactional operations of this API are provided with ongoing ITransaction, if any. You can attach any metadata to transaction, e.g. to recognize if several operations belong to the same transaction or not.
Here is an example of how attach a ODBC connection as transaction metadata:
| void GridGain.Cache.Store.ICacheStore.Delete | ( | object | key | ) |
Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
This method is invoked even if no mapping for the key exists.
| key | The key that is used for the delete operation. |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
| void GridGain.Cache.Store.ICacheStore.DeleteAll | ( | ICollection | keys | ) |
The order that individual deletes occur is undefined.
If this operation fails (by throwing an exception) after a partial success, the writer must remove any successfully written entries from the entries collection so that the caching implementation knows what succeeded and can mutate the cache.
Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
This method may include keys even if there is no mapping for that key, in which case the data represented by that key should be removed from the underlying resource.
| keys | a mutable collection of keys for entries to delete. Upon invocation, it contains the keys to delete for write-through. Upon return the collection must only contain the keys that were not successfully deleted. |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
| object GridGain.Cache.Store.ICacheStore.Load | ( | object | key | ) |
null should be returned.
| key | The key identifying the object being loaded. |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheStoreAdapter, and GridGain.Cache.Store.CacheParallelLoadStoreAdapter.
| IDictionary GridGain.Cache.Store.ICacheStore.LoadAll | ( | ICollection | keys | ) |
| keys | Keys identifying the values to be loaded. |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
| void GridGain.Cache.Store.ICacheStore.LoadCache | ( | Action< object, object > | act, |
| params object[] | args | ||
| ) |
| act | Action for loaded values. |
| args | Optional arguemnts passed to ICache<K,V>.LocalLoadCache method. |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
| void GridGain.Cache.Store.ICacheStore.SessionEnd | ( | bool | commit | ) |
| commit | True if transaction should commit, false for rollback. |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
| void GridGain.Cache.Store.ICacheStore.Write | ( | object | key, |
| object | val | ||
| ) |
This method is intended to support both key/value creation and value update.
| key | Key to write. |
| val | Value to write. |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
| void GridGain.Cache.Store.ICacheStore.WriteAll | ( | IDictionary | entries | ) |
The order that individual writes occur is undefined.
If this operation fails (by throwing an exception) after a partial success, the writer must remove any successfully written entries from the entries collection so that the caching implementation knows what succeeded and can mutate the cache.
| entries | a mutable collection to write. Upon invocation, it contains the entries to write for write-through. Upon return the collection must only contain entries that were not successfully written. (see partial success above). |
| CacheStoreException |
Implemented in GridGain.Cache.Store.CacheParallelLoadStoreAdapter, and GridGain.Cache.Store.CacheStoreAdapter.
1.8.11