> For the complete documentation index, see [llms.txt](https://xoops.gitbook.io/xmf-cookbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xoops.gitbook.io/xmf-cookbook/reference/key/storageinterface.md).

# StorageInterface

The `Xmf\Key\StorageInterface` interface defines the methods used to store and retrieve keys.

The key data is treated as string data. The actual Key class is responsible for any serialization or deserialization needed.

The *$name* parameter common to all methods is a string key name, the symbolic name of the key to use. The *$name* uniquely identifies the key in the key store. The key name should relate to a specific application action, or a closely related set of actions.

## save(*$name*, *$data*)

Save key data *$data* under the name *$name*.

Returns true if successful, otherwise false.

## fetch(*$name*)

Fetch key data stored under the name *$name*.

Returns the stored key data if successful, otherwise false.

## exists(*$name*)

Check for the existence of a key under the name *$name*.

Returns true if a key named *$name* exists, otherwise false.

## delete(*$name*)

Delete a any key stored under the name *$name*.

Returns true if successful, otherwise false.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://xoops.gitbook.io/xmf-cookbook/reference/key/storageinterface.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.
