An open API service indexing awesome lists of open source software.

https://github.com/phore/phore-cache

caching functions
https://github.com/phore/phore-cache

Last synced: 5 months ago
JSON representation

caching functions

Awesome Lists containing this project

README

          

# Phore Cache

## Installation

```bash
composer require phore/cache
```

## Basic usage

Setting a driver:

```
$pool = new CacheItemPool(new RedisCacheDriver("redis://redis"));
```

or shortcut:

```
$pool = new CacheItemPool("redis://redis");
```

Load and cache data

```php
$pool = new CacheItemPool("redis://redis");
$item = $pool->getItem("cachekey")->expiresAfter(10)->retryAfter(5);
echo $item->load(function () {
return "Data"; // Put code to load the cached value
});
```

## Filesystem driver

```
$pool = new CacheItemPool("file:///tmp");
```