diff --git a/docs/adapters.md b/docs/adapters.md new file mode 100644 index 0000000..5910a71 --- /dev/null +++ b/docs/adapters.md @@ -0,0 +1,21 @@ +# Adapters + +## APCu Adapter + +The APCu adapter requires a APCu extension. + +```php +$pool = new \Charon\Cache\Adapter\APCu\APCuAdapter( + +); +``` + +## Array Adapter + +The Array adapter is useful for testing purposes, as its data stored in memory. + +```php +$pool = new \Charon\Cache\Adapter\Array\ArrayAdapter( + +); +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..50493ca --- /dev/null +++ b/docs/index.md @@ -0,0 +1,12 @@ +# charon-cache + +## Installation + +```bash +composer require charonlab/charon-cache +``` + +## Support + +- Sources available at [github](https://github.com/charonlab/charon-cache). +- Report a bug [here](https://github.com/charonlab/charon-cache/issues) diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..f295073 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,16 @@ +# Usage + +This following example shows basic usage of the cache: +```php + +$value = $cache->get('foobar', function (\Charon\Cache\CacheItemPool $item): string { + // The callback will be called only when the cache miss. + return 'cachepool'; +}); + +// Output: 'cachepool' +echo $value; + +// Clears the cache value. +$cache->delete('foobar'); +```