@@ -27,7 +27,30 @@ Or manually update `require` block of `composer.json` and run `composer update`.
2727
2828## Using
2929
30- ### Keys Handling
30+ ### Keys And Tags
31+
32+ In addition to passing an explicit value, you can also pass objects and arrays to the ` keys ` and ` tags ` methods.
33+
34+ For example:
35+
36+ ``` php
37+ use DragonCode\Cache\Services\Cache;
38+ use DragonCode\SimpleDataTransferObject\DataTransferObject;
39+
40+ $arr1 = ['foo', 'bar']
41+ $arr2 = new ArrayObject(['foo', 'bar'])
42+ $arr3 = DataTransferObject::make(['foo', 'bar'])
43+
44+ Cache::make()->key($arr1)->tags($arr1);
45+ Cache::make()->key($arr2)->tags($arr3);
46+ Cache::make()->key($arr2)->tags($arr3);
47+
48+ Cache::make()->key([$arr1, $arr2, $arr3, 'foo', 'bar'])->tags([$arr1, $arr2, $arr3, 'foo', 'bar']);
49+ Cache::make()->key([$arr1, $arr2, $arr3, 'foo', 'bar'])->tags([$arr1, $arr2, $arr3, 'foo', 'bar']);
50+ Cache::make()->key([$arr1, $arr2, $arr3, 'foo', 'bar'])->tags([$arr1, $arr2, $arr3, 'foo', 'bar']);
51+ ```
52+
53+ #### Keys Handling
3154
3255Since the main problem of working with the cache's key compilation, this package solves it.
3356
@@ -36,7 +59,9 @@ By passing values to the `keys` method, we get a ready-made key at the output.
3659For example:
3760
3861``` php
39- $cache = Cache::make()->key('foo', 'bar', ['baz', 'baq']);
62+ use DragonCode\Cache\Services\Cache;
63+
64+ $cache = Cache::make()->key('foo', 'bar', [null, 'baz', 'baq']);
4065
4166// Key is `acbd18db4cc2f85cedef654fccc4a4d8:37b51d194a7513e45b56f6524f2d51f2:73feffa4b7f6bb68e44cf984c85f6e88:b47951d522316fdd8811b23fc9c2f583`
4267```
@@ -46,6 +71,8 @@ This means that when writing to the cache, the tree view will be used.
4671For example:
4772
4873``` php
74+ use DragonCode\Cache\Services\Cache;
75+
4976Cache::make()->key('foo', 'foo')->put('foo');
5077Cache::make()->key('foo', 'bar')->put('bar');
5178Cache::make()->key('baz')->put('baz');
0 commit comments