public class MongoStore extends BaseStore
A store which uses MongoDB.
storeListenersCLUSTERED, PERSISTENT, TRANSACTIONAL| Constructor and Description |
|---|
MongoStore(com.mongodb.DB db,
java.lang.String collectionName)
Constructor with the Mongo DB and collection name to use.
|
MongoStore(com.mongodb.DB db,
java.lang.String collectionName,
java.lang.Long timeout)
Constructor with the Mongo DB and collection name to use.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
evict()
Removes objects that have been expired.
|
boolean |
hasFeature(java.lang.String feature)
Returns true if feature is provided by the store, false else.
|
java.lang.Object |
load(java.lang.String id)
Retrieves the data of the object with the given .
|
java.lang.Object |
peek(java.lang.String id)
Retrieves the data of the object with the given without removing it.
|
java.lang.String |
store(java.lang.Object data)
Stores to a
DBObject and return the generated ID. |
void |
store(java.lang.String id,
java.lang.Object data)
Stores to a
DBObject with the given . |
addListener, fireAddedEvent, fireEvictedEvent, fireRemovedEvent, getStoreListeners, removeListenerpublic MongoStore(com.mongodb.DB db,
java.lang.String collectionName)
Constructor with the Mongo DB and collection name to use.
db - the Mongo DB.collectionName - the Mongo collection name.public MongoStore(com.mongodb.DB db,
java.lang.String collectionName,
java.lang.Long timeout)
Constructor with the Mongo DB and collection name to use. This constructor defines a connection timeout too.
db - the Mongo DB.collectionName - the Mongo collection name.timeout - the connection timeout.public boolean hasFeature(java.lang.String feature)
Returns true if feature is provided by the store, false else.
feature - the feature.public void store(java.lang.String id,
java.lang.Object data)
throws java.io.IOException
Stores to a DBObject with the given .
id - the id of the object to storedata - the object to storejava.io.IOExceptionpublic java.lang.String store(java.lang.Object data)
throws java.io.IOException
Stores to a DBObject and return the generated ID.
data - the object to storejava.io.IOExceptionpublic java.lang.Object load(java.lang.String id)
throws java.io.IOException
Retrieves the data of the object with the given .
id - the id of the objectjava.io.IOExceptionpublic java.lang.Object peek(java.lang.String id)
throws java.io.IOException
Retrieves the data of the object with the given without removing it.
id - the id of the objectjava.io.IOExceptionprotected void evict()
Removes objects that have been expired.
Copyright © 2005-2014 FuseSource. All Rights Reserved.