Click or drag to resize

IDataCachingService Interface

Defines a service which can be used by callers to store full IdentifiedData RIM objects in a transient cache.

Namespace:  SanteDB.Core.Services
Assembly:  SanteDB.Core.Api (in SanteDB.Core.Api.dll) Version: 2.2.1
Syntax
public interface IDataCachingService : IServiceImplementation

The IDataCachingService type exposes the following members.

Properties
  NameDescription
Public propertyServiceName
Gets the service name
(Inherited from IServiceImplementation.)
Public propertySize
Gets the current size of the cache in objects
Top
Methods
  NameDescription
Public methodAdd
Adds data to the cache
Public methodClear
Purges the entire cache of all entries
Public methodGetCacheItem(Guid)
Gets the cache item specified by key regardless of the type of data
Public methodGetCacheItemTData(Guid)
Gets the cache item specified by key returning it as a casted instance of TData. Returning the default of TData if the object doesn't exist or if the object is the wrong type.
Public methodRemove(Guid)
Removes/evicts an object with identifier key from the cache
Public methodRemove(IdentifiedData)
Removes/evicts the provided object form cache if available
Top
Events
  NameDescription
Public eventAdded
Fired after an object has successfully been committed to the cache
Public eventRemoved
Fired after an object has successfully been evicted from cache
Public eventUpdated
Fired after an object has successfully been updated within the cache
Top
Remarks

The data caching service is primarily used to store fully loaded objects from the database. This loading into the cache reduces the load on the persistence layer of the SanteDB host context. The data persistence layers themselves will use implementations of this class to prevent re-loading of data to/from the disk system. The process on a read is generally:

  1. Check the cache service to determine if the data has already been loaded
  2. If not found in cache load the data from disk / database
  3. Add the object to the cache

Of course, keeping the cache service in a consistent state is tantamount to the reliable functioning of SanteDB, this means that any update, delete or create on an object that already exists in cache results in its eviction from the cache via the Remove(Guid) method.

See Also