CacheProvider methods
Basic cache methods
get( key )
Gets a value from the cache.
keyThe identifier key
Returns: The stored value on the specified key, or false if it didn't exist.
set( key, value, ttl )
Stores a value into the cache
keyThe identifier keyvalueThe valuettlThe Time To Live of the stored value in seconds. Default:false
Returns: Whether the value has been correctly stored, false otherwise.
List methods
listGet( listName, key )
Retrieves an object from a list
listNameThe name of the listkeyThe key of the object
Returns: The stored value, or null if it doesn't exists.
listGetKeys( listName )
Retrieves all the keys in a list
listNameThe name of the list
Returns: An array containing all the keys in the list, an empty array if the list was empty or false if the list didn't exist.
listSet( listName, key, value)
Adds an object to a list
listNameThe name of the listkeyThe key of the objectvalueThe value of the object
Returns: True if the key wasn't on the list and it was added. False if the key already existed and it was updated.
Queue methods
queueLPop( queueName )
Returns the element at the beginning of a queue and removes it.
queueNameThe name of the queue
Returns: The value that was a the beginning of the queue, or null if the queue was empty.
queueLPush( queueName, value )
Prepends a value to the beginning of a queue.
queueNameThe name of the queuevalueThe value to prepend
Returns: True if everything went ok, false otherwise
queueRPop( queueName )
Returns the element at the end of a queue and removes it.
queueNameThe name of the queue
Returns: The value that was a the end of the queue, or null if the queue was empty.
queueRPush( queueName, value )
Appends a value to the end of a queue.
queueNameThe name of the queuevalueThe value to append
Returns: True if everything went ok, false otherwise
Pool methods
isInPool( poolName, value )
Checks whether a value is in the pool.
poolNameThe pool namevalueThe value to check
Returns: True if the value is in the pool, false otherwise
poolAdd( poolName, value )
Adds a value to a pool.
poolNameThe pool namevalueThe value to add
Returns: Whether the value has been correctly added, false otherwise
poolCount( poolName )
Counts the number of objects in the pool
poolNameThe pool name
Returns: The number of objects in the pool, or false if the pool doesn't exists.
poolPop( poolName )
Retrieves a random object of the pool and removes it.
poolNameThe pool name
Returns: The object, or null if the pool was empty.
Last updated
Was this helpful?