PHPackages                             icanboogie/storage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. icanboogie/storage

ActiveLibrary[Caching](/categories/caching)

icanboogie/storage
==================

Store and retrieve values, using different/multiple storage backends.

v4.2.0(6y ago)834.5k↓68.3%2[1 issues](https://github.com/ICanBoogie/Storage/issues)4BSD-3-ClausePHPPHP &gt;=7.1CI failing

Since Jan 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ICanBoogie/Storage)[ Packagist](https://packagist.org/packages/icanboogie/storage)[ Docs](https://icanboogie.org/)[ RSS](/packages/icanboogie-storage/feed)WikiDiscussions 6.0 Synced 3w ago

READMEChangelog (8)DependenciesVersions (16)Used By (4)

Storage
=======

[](#storage)

[![Release](https://camo.githubusercontent.com/248e893a6073745ecc9cb3aa402fc1861b70486897b768d441dd1e47f2b4cd33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6963616e626f6f6769652f73746f726167652e737667)](https://github.com/ICanBoogie/Storage/releases)[![Code Coverage](https://camo.githubusercontent.com/8496769d7003fe946bcfa4499e4fc7b83ca2910f12c52e2252d6c2bc8e25d807/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4943616e426f6f6769652f53746f726167652f62616467652e7376673f6272616e63683d362e30)](https://coveralls.io/r/ICanBoogie/Storage?branch=6.0)[![Packagist](https://camo.githubusercontent.com/9f280edd956d19a6f927b0572d2dc7d87f54860ff586dc75df9a4c1715327694/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6963616e626f6f6769652f73746f726167652e737667)](https://packagist.org/packages/icanboogie/storage)

**icanboogie/storage** defines an API to store and retrieve values, while offering different storage backends.

Values can be stored using the runtime memory, [Redis](http://redis.io/), [APC](http://php.net/manual/en/book.apc.php), the file system… Storage collections retrieve and store values using multiple different storage instances, that usually range from the less expensive (and the more volatile) to the more expensive (and the more durable).

This package includes the following storage backends:

- [RunTimeStorage](https://icanboogie.org/api/storage/master/class-ICanBoogie.Storage.RunTimeStorage.html): Uses a PHP array.
- [RedisStorage](https://icanboogie.org/api/storage/master/class-ICanBoogie.Storage.RedisStorage.html): Uses a [Redis](http://redis.io/) instance.
- [APCStorage](https://icanboogie.org/api/storage/master/class-ICanBoogie.Storage.APCStorage.html): Uses [APC](http://php.net/manual/en/book.apc.php) or [APCu](https://github.com/krakjoe/apcu).
- [FileStorage](https://icanboogie.org/api/storage/master/class-ICanBoogie.Storage.FileStorage.html): Uses the file system.
- [StorageCollection](https://icanboogie.org/api/storage/master/class-ICanBoogie.Storage.StorageCollection.html): Uses a collection of storage.

#### Installation

[](#installation)

```
composer require icanboogie/storage
```

Storage
-------

[](#storage-1)

A storage is used to store a value and retrieve it later. A unique key is used to identify the value. Different storage store values using different mechanisms, and sometimes for a different period of time. It's always a good idea to choose the storage that best fits a situation, according to the persistence requirement and the expensiveness of the storage.

> **Note:** Storage classes implement the [Storage](https://icanboogie.org/api/storage/master/class-ICanBoogie.Storage.Storage.html) interface, including the [StorageCollection](https://icanboogie.org/api/storage/master/class-ICanBoogie.Storage.StorageCollection.html) class.

```
