# IObjectStore

**class** : `cachebox.system.cache.store.IObjectStore`

A CacheBox cache provider uses the concept of an object store in order to, well, store its cached objects. This can be anything as we have created an interface that anybody can implement and create their own object storages. Just be aware that the CacheBox provider's eviction policies use certain methods for reporting and evictions that MUST be implemented.

## Interface Methods

| Method                                                                                           | Description                                                                                        |
| ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
| `flush()`                                                                                        | Flush the store to disk or finalize any pending write operations                                   |
| `reap()`                                                                                         | Reap expired objects from the store                                                                |
| `clearAll()`                                                                                     | Remove all objects from the store                                                                  |
| `getKeys()`                                                                                      | Get an array of all cached object keys                                                             |
| `lookup( required objectKey )`                                                                   | Check whether an object key exists in the store                                                    |
| `get( required objectKey )`                                                                      | Get an object from the store                                                                       |
| `getQuiet( required objectKey )`                                                                 | Get an object without touching access statistics                                                   |
| `expireObject( required objectKey )`                                                             | Force-expire an object in the store                                                                |
| `isExpired( required objectKey )`                                                                | Check whether a stored object has expired                                                          |
| `set( required objectKey, required object, [timeout], [lastAccessTimeout], [extra] )`            | Store an object with optional timeout settings                                                     |
| `clear( required objectKey )`                                                                    | Remove an object from the store                                                                    |
| `getSize()`                                                                                      | Get the total number of objects in the store                                                       |
| `getSortedKeys( required string property, required string sortType, required string sortOrder )` | Get all object keys sorted by a metadata property; **required** by eviction policy implementations |


---

# 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://cachebox.ortusbooks.com/for-the-geeks/cachebox-architecture/iobjectstore.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.
