Stateful Query Provider
Last updated
Last updated
IQueryPersistenceService
in assembly SanteDB.Core.Api version 3.0.1980.0
Defines a service which can store the results of a query for later retrieval
When implementing query on a shared infrastructure such as the SanteDB iCDR or dCDR, it is important that consistent result sets be returned. This is important not only for user interfaces, but is vital to consistent synchronization across devices.
There are several reasons we keep stateful query result sets in SanteDB:
User interfaces will have consistent pages, so results don't magically "appear" between paging results
Synchronization processes have a consistent paging result set as they download data
The heavy initial query is done only once and results are merely accessed afterwards
Implementers of this service should ensure that whatever technology they are using to store queries have the capability of expiration (i.e. queries are not stateful indefinitely), support the rapid read and update of result sets, and are cabable of being aborted/abandoned.
Operation | Response/Return | Input/Parameter | Description |
---|---|---|---|
An implementation of the IQueryPersistenceService which uses in-process memory to store query result sets
This implementation of the query persistence service uses the MemoryCache implementation to store stateful query results (for consistent pagination) for a period of time in transient place.
An implementation of the IQueryPersistenceService which usees REDIS for its stateful result set
This persistence service uses REDIS list values to store the UUIDs representing the query executed on the SanteDB server. The data is stored in database 2 of the REDIS server.
FindQueryId
Guid
Object queryTag
Locate the stateful query identifier using the tag which was attached to the query
RegisterQuerySet
Boolean
Guid queryId IEnumerable<Guid> results Object tag Int32 totalResults
Registers a new query result set with the stateful query provider
IsRegistered
Boolean
Guid queryId
Returns true if the query identifier has been registered
GetQueryResults
IEnumerable<Guid>
Guid queryId Int32 offset Int32 count
Retrieves the result keys located between and + in the stateful query provider
GetQueryTag
Object
Guid queryId
Retrieves the query tag stored when the query was registered, for the specified
QueryResultTotalQuantity
Int64
Guid queryId
Count the number of query results which have been registered for
AddResults
void
Guid queryId IEnumerable<Guid> results Int32 totalResults
Adds more results to an already registered stateful query
SetQueryTag
void
Guid queryId Object value
Adds or changes the query tag on to
AbortQuerySet
void
Guid queryId
Abort the query