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

# API

- [stash-it](https://stash-it.gitbook.io/stash-it/api/stash-it.md)
- [createCache(adapter)](https://stash-it.gitbook.io/stash-it/api/stash-it/createcache-adapter.md): Creates a cache instance.
- [createItem(key, value, \[extra\])](https://stash-it.gitbook.io/stash-it/api/stash-it/createitem-key-value-extra.md): Creates an item.
- [getPreData(methodName, args)](https://stash-it.gitbook.io/stash-it/api/stash-it/getpredata-methodname-args.md): Returns \`pre\` (in terms of lifecycle of given method) data which is passed through all of the hooks registered for that particular method.
- [getPostData(methodName, args)](https://stash-it.gitbook.io/stash-it/api/stash-it/getpostdata-methodname-args.md): Returns \`post\` (in terms of lifecycle of given method) data which is passed through all of the hooks registered for that particular method.
- [cacheInstance](https://stash-it.gitbook.io/stash-it/api/cacheinstance.md)
- [addHook(hook)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/addhook-hook.md): Adds a hook.
- [addHooks(hooks)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/addhooks-hooks.md): Adds hooks.
- [getHooks()](https://stash-it.gitbook.io/stash-it/api/cacheinstance/gethooks.md): Returns hooks.
- [buildKey(key)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/buildkey-key.md): Builds a key.
- [getItem(key)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/getitem-key.md): Returns an item.
- [getExtra(key)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/getextra-key.md): Returns extra (for given object for given key).
- [addExtra(key, extra)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/addextra-key-extra.md): Adds extra to item's existing extra. New properties are added, existing are overwritten.
- [setExtra(key, extra)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/setextra-key-extra.md): Sets (replaces whole existing) extra in an item.
- [setItem(key, value, \[extra\])](https://stash-it.gitbook.io/stash-it/api/cacheinstance/setitem-key-value-extra.md): Sets an item (and returns it, once created).
- [hasItem(key)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/hasitem-key.md): Checks if item exists.
- [removeItem(key)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/removeitem-key.md): Removes an item.
- [registerPlugins(plugins)](https://stash-it.gitbook.io/stash-it/api/cacheinstance/registerplugins-plugins.md): Registers plugins and returns new instance of self (cacheInstance) extended with functionalities provided by plugins.
- [Adapter](https://stash-it.gitbook.io/stash-it/api/adapter.md)
- [buildKey(key)](https://stash-it.gitbook.io/stash-it/api/adapter/buildkey-key.md): Builds a key.
- [getItem(key)](https://stash-it.gitbook.io/stash-it/api/adapter/getitem-key.md): Returns an item.
- [getExtra(key)](https://stash-it.gitbook.io/stash-it/api/adapter/getextra-key.md): Returns and extra.
- [addExtra(key, extra)](https://stash-it.gitbook.io/stash-it/api/adapter/addextra-key-extra.md): Adds extra to given item.
- [setExtra(key, extra)](https://stash-it.gitbook.io/stash-it/api/adapter/setextra-key-extra.md): Sets (replaces existing) extra.
- [setItem(key, value, \[extra\])](https://stash-it.gitbook.io/stash-it/api/adapter/setitem-key-value-extra.md): This method sets an item and returns it as well.
- [hasItem(key)](https://stash-it.gitbook.io/stash-it/api/adapter/hasitem-key.md): Checks if items exists.
- [removeItem(key)](https://stash-it.gitbook.io/stash-it/api/adapter/removeitem-key.md): Removes an item.


---

# 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, and the optional `goal` query parameter:

```
GET https://stash-it.gitbook.io/stash-it/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
