Title: | Extra Cache |
---|---|
Description: | More cache backends. |
Authors: | Colin Fay [aut, cre] |
Maintainer: | Colin Fay <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9002 |
Built: | 2024-11-17 03:24:18 UTC |
Source: | https://github.com/ThinkR-open/bank |
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.
A Caching object for postgres
A Caching object for postgres
Create a cache backend with postgres
new()
Start a new postgres cache
cache_postgres$new( ..., cache_table = "bankrcache", algo = "sha512", compress = FALSE )
...
Parameters passes do DBI::dbConnect(RPostgres::Postgres(), ...)
cache_table
On initialize()
, the cache object will create a table
to store the cache. Default name is bankrcache
. Change it if you already
have a table named bankrcache
in your DB.
algo
for {memoise}
compatibility, the digest()
algorithm
compress
for {memoise}
compatibility, should the data be compressed?
A cache_postgres object
has_key()
Does the cache contains a given key?
cache_postgres$has_key(key)
key
Name of the key.
TRUE/FALSE
get()
Get a key from the cache
cache_postgres$get(key)
key
Name of the key.
The value stored using the key
set()
Set a key in the cache
cache_postgres$set(key, value)
key
Name of the key.
value
Value to store
Used for side effect
reset()
Clear all the cache
cache_postgres$reset()
Used for side-effect
remove()
Remove a key/value pair
cache_postgres$remove(key)
key
Name of the key.
Used for side-effect
keys()
List all the keys in the cache
cache_postgres$keys()
A list of keys
digest()
Function that runs an hash algo.
For compatibily with {memoise}
cache_postgres$digest(...)
...
the value to hash
A function
clone()
The objects of this class are cloneable with this method.
cache_postgres$clone(deep = FALSE)
deep
Whether to make a deep clone.
A Caching object for redis
A Caching object for redis
Create a cache backend with redis
new()
Start a new redis cache
cache_redis$new(..., version = NULL, algo = "sha512", compress = FALSE)
...
Named configuration options passed to redis_config, used to create the environment (notable keys include host, port, and the environment variable REDIS_URL). For redis_available, arguments are passed through to hiredis.
version
Version of the interface to generate. If given as a string to numeric version, then only commands that exist up to that version will be included. If given as TRUE, then we will query the Redis server (with INFO) and extract the version number that way.
algo
for {memoise}
compatibility, the digest()
algorithm
compress
for {memoise}
compatibility, should the data be compressed?
A cache_redis object
get()
Get a key from the cache
cache_redis$get(key)
key
Name of the key.
The value stored using the key
set()
Set a key in the cache
cache_redis$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_redis$has_key(key)
key
Name of the key.
TRUE/FALSE
reset()
Clear all the cache
cache_redis$reset()
Used for side-effect
remove()
Remove a key/value pair
cache_redis$remove(key)
key
Name of the key.
Used for side-effect
keys()
List all the keys in the cache
cache_redis$keys()
A list of keys
digest()
Function that runs an hash algo.
For compatibily with {memoise}
cache_redis$digest(...)
...
the value to hash
A function
clone()
The objects of this class are cloneable with this method.
cache_redis$clone(deep = FALSE)
deep
Whether to make a deep clone.