https://github.com/phore/phore-cache
caching functions
https://github.com/phore/phore-cache
Last synced: 5 months ago
JSON representation
caching functions
- Host: GitHub
- URL: https://github.com/phore/phore-cache
- Owner: phore
- Created: 2018-12-19T10:53:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-10T09:25:29.000Z (almost 6 years ago)
- Last Synced: 2025-07-23T13:53:55.198Z (11 months ago)
- Language: PHP
- Homepage: https://infracamp.org/project/phore/
- Size: 59.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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");
```