To check if an key is cached in redis you write the following
isCached(key, callback);
To cache data you run the following function
cache(
key,
document,
settings,
callback
);
Settigns could be the following
{
forceUpdate: true,
duration: -1
}
forceUpdate set to true overwrites the data if already cached duration is how long the key should be active, -1 is infinite
To uncache data the following function is called
unCache(
key,
settings,
callback
);
Settings could be the following
{
forceDel: true,
duration: 10
}
forceDel deletes the key without taking duration into account duration sets a duration for when it should delete
To set data you run the following function
setData(
key,
document,
data,
settings,
callback
);
settings can be
{
cache: true,
duration: 100,
forceUpdate: false
}
cache is whether the data should be cached duration and forceUpdate is only taking into consideration if cache is true duration is how long the key should be cached forceUpdate overwrites any old cache with the same key
to get data you run
getData(
key,
document,
settings,
callback
);
settings can be
{
cache: true,
duration: 100,
forceUpdate: false
}
cache is whether the data should be cached duration and forceUpdate is only taking into consideration if cache is true duration is how long the key should be cached forceUpdate overwrites any old cache with the same key
to update data run
updateData(
key,
doc,
query,
data,
settings
);
settings take
{
cache: true,
duration: 100,
forceUpdate: false
}
cache is whether the data should be cached duration and forceUpdate is only taking into consideration if cache is true duration is how long the key should be cached forceUpdate overwrites any old cache with the same key
query is written in the following way
{
key: key,
// Any know data
}
delete data with
deleteData(
key,
document,
query,
settings,
callback
);
settings take
{
keepCached: true,
duration: 100,
}
keepCached is if the data being removed should be stored duration is how long the key should be cached. Can't be -1 as it should be deleted