You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ As of writing, several Laravel cache drivers do not have automatic removal of ex
14
14
-`file`
15
15
-`database`
16
16
17
-
## Why is it a problem?
17
+
###Why is it a problem?
18
18
Using any of the above cache drivers without regularly removing the expired items (aka "key eviction" in Redis) can result in storage overload, especially when you are creating a lot of temporary items with random keys.
19
19
20
20
The `cache:clear` command from Laravel works, but might not be the thing you want. It does not check item expiry (it removes everything), and also clears the Laravel framework cache (e.g. `/bootstrap/cache/*`), which can be especially problematic when you are using the `file` cache driver (consider a case: cache items are created by the `www-data` user but `/bootstrap/cache/*` is owned by the `ubuntu` user).
@@ -23,14 +23,14 @@ In this case, this library can help you remove only the expired items in your ca
23
23
24
24
This library is designed to be memory efficient and (for `database` caches) non-blocking, so even if there are a lot of items in the cache (e.g. you are running this for the first time to deal with an oversized cache), it can still run reasonably well.
This library checks the cache *name* (not *driver*!) inside `cache.php` to determine which cache to clear. This means, if you have the following `cache.php` ...
... then, you will only evict the `local_store` cache. The `another_store` cache is unaffected by this command (assuming both are using separate directories, of course).
95
95
96
-
# Testing
96
+
##Testing
97
97
Using `orchestra/testbench` (customized PHPUnit) via Composer:
98
98
99
99
```sh
100
100
composer run-script test
101
101
```
102
102
103
-
# Frequently-asked questions (FAQ)
103
+
##Frequently-asked questions (FAQ)
104
104
105
-
## How to define custom eviction strategies?
105
+
###How to define custom eviction strategies?
106
106
You can do so inside your Laravel service provider. Simply do the following:
107
107
108
108
```php
@@ -117,7 +117,7 @@ public function boot()
117
117
}
118
118
```
119
119
120
-
## Will this library help me reclaim `database` disk spaces?
120
+
###Will this library help me reclaim `database` disk spaces?
121
121
No, but if you are using this library regularly to evict expired items, then you do not need to worry about reclaiming free space. For more details, talk with a system admin/database specialist.
0 commit comments