# CacheProvider methods

## Basic cache methods

## get( key ) <a href="#get" id="get"></a>

Gets a value from the cache.

* **`key`** The identifier key

**Returns:** The stored value on the specified key, or false if it didn't exist.

## set( key, value, ttl ) <a href="#set" id="set"></a>

Stores a value into the cache

* **`key`** The identifier key
* **`value`** The value
* **`ttl`** The [Time To Live](/version-1.x-beta/guide/cache-guide.md#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 ) <a href="#listget" id="listget"></a>

Retrieves an object from a list

* **`listName`** The name of the list
* **`key`** The key of the object

**Returns:** The stored value, or null if it doesn't exists.

## listGetKeys( listName ) <a href="#listgetkeys" id="listgetkeys"></a>

Retrieves all the keys in a list

* **`listName`** The 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) <a href="#listset" id="listset"></a>

Adds an object to a list

* **`listName`** The name of the list
* **`key`** The key of the object
* **`value`** The 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 ) <a href="#queuelpop" id="queuelpop"></a>

Returns the element at the beginning of a queue and removes it.

* **`queueName`** The 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 ) <a href="#queuelpush" id="queuelpush"></a>

Prepends a value to the beginning of a queue.

* **`queueName`** The name of the queue
* **`value`** The value to prepend

**Returns:** True if everything went ok, false otherwise

## queueRPop( queueName ) <a href="#queuerpop" id="queuerpop"></a>

Returns the element at the end of a queue and removes it.

* **`queueName`** The 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 ) <a href="#queuerpush" id="queuerpush"></a>

Appends a value to the end of a queue.

* **`queueName`** The name of the queue
* **`value`** The value to append

**Returns:** True if everything went ok, false otherwise

## Pool methods

## isInPool( poolName, value ) <a href="#isinpool" id="isinpool"></a>

Checks whether a value is in the pool.

* **`poolName`** The pool name
* **`value`** The value to check

**Returns:** True if the value is in the pool, false otherwise

## poolAdd( poolName, value ) <a href="#pooladd" id="pooladd"></a>

Adds a value to a pool.

* **`poolName`** The pool name
* **`value`** The value to add

**Returns:** Whether the value has been correctly added, false otherwise

## poolCount( poolName ) <a href="#poolcount" id="poolcount"></a>

Counts the number of objects in the pool

* **`poolName`** The 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.

* **`poolName`** The pool name

**Returns:** The object, or null if the pool was empty.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cherrycake.tin.cat/version-1.x-beta/reference/core-classes/cacheprovider/cacheprovider-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
