public class MongoDocumentStore extends Object implements DocumentStore
DocumentStore.Collection| Constructor and Description |
|---|
MongoDocumentStore(com.mongodb.DB db) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
create(DocumentStore.Collection collection,
List<UpdateOp> updateOps)
Try to create a list of documents.
|
Map<String,Object> |
createOrUpdate(DocumentStore.Collection collection,
UpdateOp update)
Create or update a document.
|
void |
dispose()
Dispose this instance.
|
void |
finalize() |
Map<String,Object> |
find(DocumentStore.Collection collection,
String key)
Get a document.
|
Map<String,Object> |
find(DocumentStore.Collection collection,
String key,
int maxCacheAge)
Get a document, ignoring the cache if the cached entry is older than the
specified time.
|
Map<String,Object> |
findAndUpdate(DocumentStore.Collection collection,
UpdateOp update)
Performs a conditional update (e.g.
|
void |
invalidateCache()
Invalidate the document cache.
|
void |
invalidateCache(DocumentStore.Collection collection,
String key)
Invalidate the document cache for the given key.
|
boolean |
isCached(DocumentStore.Collection collection,
String key)
Check whether the given document is in the cache.
|
List<Map<String,Object>> |
query(DocumentStore.Collection collection,
String fromKey,
String toKey,
int limit)
Get a list of documents where the key is greater than a start value and
less than an end value.
|
void |
remove(DocumentStore.Collection collection,
String key)
Remove a document.
|
public void finalize()
throws Throwable
public void invalidateCache()
DocumentStoreinvalidateCache in interface DocumentStorepublic void invalidateCache(DocumentStore.Collection collection, String key)
DocumentStoreinvalidateCache in interface DocumentStorecollection - the collectionkey - the keypublic Map<String,Object> find(DocumentStore.Collection collection, String key)
DocumentStoreThe returned map is a clone (the caller can modify it without affecting the stored version).
find in interface DocumentStorecollection - the collectionkey - the keypublic Map<String,Object> find(DocumentStore.Collection collection, String key, int maxCacheAge)
DocumentStoreThe returned map is a clone (the caller can modify it without affecting the stored version).
find in interface DocumentStorecollection - the collectionkey - the keymaxCacheAge - the maximum age of the cached document@Nonnull public List<Map<String,Object>> query(DocumentStore.Collection collection, String fromKey, String toKey, int limit)
DocumentStorequery in interface DocumentStorecollection - the collectionfromKey - the start value (excluding)toKey - the end value (excluding)limit - the maximum number of entries to returnpublic void remove(DocumentStore.Collection collection, String key)
DocumentStoreremove in interface DocumentStorecollection - the collectionkey - the key@Nonnull public Map<String,Object> createOrUpdate(DocumentStore.Collection collection, UpdateOp update) throws org.apache.jackrabbit.mk.api.MicroKernelException
DocumentStorecreateOrUpdate in interface DocumentStorecollection - the collectionupdate - the update operationorg.apache.jackrabbit.mk.api.MicroKernelException - if the operation failed.public Map<String,Object> findAndUpdate(DocumentStore.Collection collection, UpdateOp update) throws org.apache.jackrabbit.mk.api.MicroKernelException
DocumentStoreUpdateOp.Operation.Type.CONTAINS_MAP_ENTRY and only updates the
document if the condition is true.findAndUpdate in interface DocumentStorecollection - the collectionupdate - the update operation with the conditionnull if the condition is not met.org.apache.jackrabbit.mk.api.MicroKernelException - if the operation failed.public boolean create(DocumentStore.Collection collection, List<UpdateOp> updateOps)
DocumentStorecreate in interface DocumentStorecollection - the collectionupdateOps - the list of documents to addpublic void dispose()
DocumentStoredispose in interface DocumentStorepublic boolean isCached(DocumentStore.Collection collection, String key)
DocumentStoreisCached in interface DocumentStorecollection - the collectionkey - the keyCopyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.