Skip to content

Commit c27680c

Browse files
committed
update readme.md
1 parent 520ddd2 commit c27680c

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

readme.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
[![Build](https://github.com/hareland/multi-cache-remember/actions/workflows/pest.yml/badge.svg)](https://github.com/hareland/multi-cache-remember/actions/workflows/pest.yml)
22
### What does this package solve?
33

4-
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.
4+
---
55

6+
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.
67

8+
---
79
> The rememberMany macro for the Laravel Cache facade provides several advantages over the traditional method of
810
> looking up multiple cache keys one by one.
911
10-
### And...?
11-
1. Reduced number of cache lookups: With the traditional method, each cache key is looked up individually, even if some
12-
of them are being retrieved in quick succession. With the rememberMany macro, all the requested keys are retrieved
13-
in a single call to Cache::many(), which can significantly reduce the number of cache lookups and improve
14-
performance.
1512

16-
2. Customizable cache expiration: The rememberMany macro allows you to specify an expiration time for all the cached
17-
values at once, which can simplify the cache management process and make it easier to ensure that your cached data is
18-
up-to-date.
19-
20-
3. Callbacks for missing keys: The rememberMany macro allows you to specify a callback function for each cache key,
21-
which will be called only if the key is not found in the cache. This is similar to the `Cache::remember()` method.
2213

2314
### Install
2415

2516
```bash
2617
composer require hareland/multi-cache-remember
2718
```
2819

29-
### Register ServiceProvider (if you need to)
20+
### Register ServiceProvider (if you must)
3021

3122
```php
3223
// in config/app.php
@@ -62,4 +53,22 @@ use Illuminate\Support\Facades\Cache;
6253
'dashboard.stats.sales:org:3' => [fn() => \App\Models\StatsForOrf::findFor(request()->user()->currentOrg), 60 * 5],
6354
'dashboard.stats.overview:org:3' => fn() => \App\Models\OverviewStats::findFor(request()->user()->currentOrg),
6455
], 60); // 60 seconds is the default TTL for any keys that does not have a custom one.
65-
```
56+
```
57+
---
58+
59+
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/hareland)
60+
61+
---
62+
### And...?
63+
1. Reduced number of cache lookups: With the traditional method, each cache key is looked up individually, even if some
64+
of them are being retrieved in quick succession. With the rememberMany macro, all the requested keys are retrieved
65+
in a single call to Cache::many(), which can significantly reduce the number of cache lookups and improve
66+
performance.
67+
68+
2. Customizable cache expiration: The rememberMany macro allows you to specify an expiration time for all the cached
69+
values at once, which can simplify the cache management process and make it easier to ensure that your cached data is
70+
up-to-date.
71+
72+
3. Callbacks for missing keys: The rememberMany macro allows you to specify a callback function for each cache key,
73+
which will be called only if the key is not found in the cache. This is similar to the `Cache::remember()` method.
74+

0 commit comments

Comments
 (0)