Download the PHP package dragon-code/laravel-cache without Composer

On this page you can find all versions of the php package dragon-code/laravel-cache. 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

Smart Cache for Laravel

Laravel Cache

Stable Version Unstable Version Total Downloads Github Workflow Status

Installation

To get the latest version of Smart Cache, simply require the project using Composer:

Or manually update require block of composer.json and run composer update.

Using

Keys And Tags

In addition to passing an explicit value, you can also pass objects and arrays to the keys and tags methods.

For example:

Unpacking and processing of objects occurs as follows:

Keys Handling

Since the main problem of working with the cache's key compilation, this package solves it.

By passing values to the keys method, we get a ready-made key at the output.

The hash is formed by the value key=value, which allows avoiding collisions when passing identical objects.

In the case of passing nested arrays, the key is formed according to the principle key1.key2=value, where key1 and key2 are the keys of each nested array.

For example:

This means that when writing to the cache, the tree view will be used.

For example:

Disable key hashing

In some cases, you need to disable the use of the key hashing mechanism. To do this, simply call the hashKey(false) method:

With Authentication

In some cases, it is necessary to bind the cache to certain users. To do this, we have added the withAuth helper.

When processing requests with a call to the withAuth method, the binding will be carried out not only by identifier, but also by reference to the model class, since a project can have several models with the possibility of authorization.

For example, App\Models\Employee, App\Models\User.

When Enabled

Basic

Method Call Chain

Sometimes in the process of working with a cache, it becomes necessary to call some code between certain actions, and in this case the call method will come to the rescue:

In addition, the forget method now returns an instance of the Cache object, so it can be used like this:

Previously, you had to use the following sequence:

Custom TTL

By default, the cache will be written for 1 day.

The cache will be written for the specified number of minutes, seconds or the DateTimeInterface instance.

It does not matter in which direction the time shift will be. During processing, the value is converted to the abs().

As Minutes
As Seconds
By Objects And Custom Strings

You can also store all TTL values in one place - in the config/cache.php file.

To do this, add a ttl block to the file and define a TTL for the objects.

After that you can use the following construction:

If the value is not found, the default value will be taken, which you can also override in the configuration file.

With Contract

Starting with version 2.9.0, we added the ability to dynamically specify TTLs in objects. To do this, you need to implement the DragonCode\Contracts\Cache\Ttl contract into your object and add a method that returns one of the following types of variables: DateTimeInterface , Carbon\Carbon, string or integer.

This method will allow you to dynamically specify the TTL depending on the code being executed.

For example:

Tagged

For repositories that support tagging, the keys will be saved separated by tags.

To retrieve a tagged cache item, pass the same ordered list of tags to the tags method and then call the get method with the key you wish to retrieve:

See the official Laravel documentation.

When Disabled

Passing when = false will not write to the cache.

You can also define whether to enable or disable the use of cache storage in the settings.

For example:

License

This package's licensed under the MIT License.


All versions of laravel-cache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
dragon-code/contracts Version ^2.21
dragon-code/support Version ^6.11.3
illuminate/support Version >=6.0 <12.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 dragon-code/laravel-cache contains the following files

Loading the files please wait ....