cache_mongo | R Documentation |
A Caching object for MongoDB
A Caching object for MongoDB
Create a cache backend with MongoDB.
new()
Start a new mongo cache
cache_mongo$new( db = "test", url = "mongodb://localhost", prefix = "fs", options = mongolite::ssl_options(), algo = "sha512", compress = FALSE )
db
name of database
url
address of the mongodb server in mongo connection string URI format
prefix
string to prefix the collection name
options
additional connection options such as SSL keys/certs.
algo
for {memoise}
compatibility. The digest()
algorithm.
compress
for {memoise}
compatibility. Should the data be compressed?
A cache_mongo object
get()
Get a key from the cache
cache_mongo$get(key)
key
Name of the key.
The value stored using the key
set()
Set a key in the cache
cache_mongo$set(key, value)
key
Name of the key.
value
Value to store
Used for side effect
has_key()
Does the cache contains a given key?
cache_mongo$has_key(key)
key
Name of the key.
TRUE/FALSE
reset()
Clear all the cache
cache_mongo$reset()
Used for side-effect
remove()
Remove a key/value pair
cache_mongo$remove(key)
key
Name of the key.
Used for side-effect
keys()
List all the keys in the cache
cache_mongo$keys()
A list of keys
digest()
Function that runs an hash algo.
For compatibily with {memoise}
.
cache_mongo$digest(...)
...
the value to hash
A function
clone()
The objects of this class are cloneable with this method.
cache_mongo$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.