|
6 | 6 |
|
7 | 7 | This package offers the rememberMany macro for the Laravel Cache facade, providing efficient retrieval of multiple cache keys with customizable expiration and callbacks for missing keys.
|
8 | 8 |
|
9 |
| ---- |
| 9 | + |
10 | 10 | > The rememberMany macro for the Laravel Cache facade provides several advantages over the traditional method of
|
11 | 11 | > looking up multiple cache keys one by one.
|
12 | 12 |
|
| 13 | +--- |
| 14 | + |
| 15 | +### Why? |
| 16 | + |
| 17 | +1. Reduced number of cache lookups: With the traditional method, each cache key is looked up individually, even if some |
| 18 | + of them are being retrieved in quick succession. With the rememberMany macro, all the requested keys are retrieved |
| 19 | + in a single call to Cache::many(), which can significantly reduce the number of cache lookups and improve |
| 20 | + performance. |
| 21 | + |
| 22 | +2. Customizable cache expiration: The rememberMany macro allows you to specify an expiration time for all the cached |
| 23 | + values at once, which can simplify the cache management process and make it easier to ensure that your cached data is |
| 24 | + up-to-date. |
| 25 | + |
| 26 | +3. Callbacks for missing keys: The rememberMany macro allows you to specify a callback function for each cache key, |
| 27 | + which will be called only if the key is not found in the cache. This is similar to the `Cache::remember()` method. |
13 | 28 |
|
| 29 | +--- |
14 | 30 |
|
15 | 31 | ### Install
|
16 | 32 |
|
@@ -59,17 +75,3 @@ use Illuminate\Support\Facades\Cache;
|
59 | 75 |
|
60 | 76 | [](https://www.buymeacoffee.com/hareland)
|
61 | 77 |
|
62 |
| ---- |
63 |
| -### And...? |
64 |
| -1. Reduced number of cache lookups: With the traditional method, each cache key is looked up individually, even if some |
65 |
| - of them are being retrieved in quick succession. With the rememberMany macro, all the requested keys are retrieved |
66 |
| - in a single call to Cache::many(), which can significantly reduce the number of cache lookups and improve |
67 |
| - performance. |
68 |
| - |
69 |
| -2. Customizable cache expiration: The rememberMany macro allows you to specify an expiration time for all the cached |
70 |
| - values at once, which can simplify the cache management process and make it easier to ensure that your cached data is |
71 |
| - up-to-date. |
72 |
| - |
73 |
| -3. Callbacks for missing keys: The rememberMany macro allows you to specify a callback function for each cache key, |
74 |
| - which will be called only if the key is not found in the cache. This is similar to the `Cache::remember()` method. |
75 |
| - |
|
0 commit comments