From 1db655325397d8d7a805d0c62dc16d218fe59006 Mon Sep 17 00:00:00 2001 From: Dominik Szamburski Date: Fri, 23 Feb 2024 05:24:35 +0100 Subject: [PATCH] docs: adding a documentation --- docs/adapters.md | 21 +++++++++++++++++++++ docs/index.md | 12 ++++++++++++ docs/usage.md | 16 ++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 docs/adapters.md create mode 100644 docs/index.md create mode 100644 docs/usage.md 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'); +```