Download the PHP package vectorial1024/laravel-cache-evict without Composer

On this page you can find all versions of the php package vectorial1024/laravel-cache-evict. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cache-evict

laravel-cache-evict

Packagist License Packagist Version Packagist Downloads PHP Dependency Version GitHub Actions Workflow Status GitHub Repo Stars

Efficiently remove expired cache data in Laravel.

Situation

As of writing, several Laravel cache drivers do not have automatic removal of expired cached items:

Why is it a problem?

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.

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).

In this case, this library can help you remove only the expired items in your cache. See below sections for more details.

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.

Install

via Composer:

Supported cache types

The following cache drivers from cache.php are currently supported:

Some drivers (e.g. memcached, redis) will never be supported because they have their own item eviction mechanisms; use those features instead of this library!

Custom eviction strategies can be defined for other cache drivers that does not have their own eviction mechanisms (see FAQ section).

Usage

You may run this in the command line:

Or, you may put this into your console kernel schedule:

The relationship with cache.php

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 ...

... and you run the command like this ...

... 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).

Testing

Using orchestra/testbench (customized PHPUnit) via Composer:

Frequently-asked questions (FAQ)

How to define custom eviction strategies?

You can do so inside your Laravel service provider. Simply do the following:

Will this library help me reclaim database disk spaces?

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.


All versions of laravel-cache-evict with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
wilderborn/partyline Version ^1.0
ramazancetinkaya/byte-formatter Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vectorial1024/laravel-cache-evict contains the following files

Loading the files please wait ....