Download the PHP package mostafaznv/laracache without Composer

On this page you can find all versions of the php package mostafaznv/laracache. 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 laracache

LaraCache

GitHub Workflow Status Codecov branch Quality Score GitHub license Packagist Downloads Latest Version on Packagist

laracache

Using this package, you can cache your heavy and most used queries.

All you have to do is to define the CacheEntity objects in the model and specify a valid name and ttl for them.

LaraCache will handle the rest of process automatically. It will create and update cache entities based on ttl that you've defined for each entity.

Manually updating the cache entities of models after dispatching model events (creating, updating and deleting) isn't required, LaraCache manages them in the background and ensures the most up-to-date version of each cache entity.

In addition to the core LaraCache package, I have developed a complementary package called Nova LaraCache. Nova LaraCache seamlessly integrates LaraCache with Laravel Nova, the administration panel for Laravel applications. It offers a user-friendly interface within the Laravel Nova administration panel, enabling users to conveniently moderate and manage cache entities.


I am on an open-source journey 🚀, and I wish I could solely focus on my development path without worrying about my financial situation. However, as life is not perfect, I have to consider other factors.

Therefore, if you decide to use my packages, please kindly consider making a donation. Any amount, no matter how small, goes a long way and is greatly appreciated. 🍺

Donate


Requirements:

Installation

  1. Install the package via composer:
  2. Publish config file:
  3. Done

Usage

  1. Add LaraCache trait to the model
  2. Retrieve Cache

Table of Contents:

CacheEntity Methods

method Arguments description
setDriver driver (type: string) Specifies custom driver for cache entity
isQueueable status (type: bool, default: 'true')
onConnection (type: string, default: '')
onQueue (type: string, default: '')
This option specifies whether the cache operation should be performed in the background or not.
Note: By using the onConnection and onQueue arguments, you have the ability to specify custom connection and queue names for each cache entity.
refreshAfterCreate status (type: bool, default: true) Specifies if the cache should refresh after create a record
refreshAfterUpdate status (type: bool, default: true) Specifies if the cache should refresh after update a record
refreshAfterDelete status (type: bool, default: true) Specifies if the cache should refresh after delete a record
refreshAfterRestore status (type: bool, default: true) Specifies if the cache should refresh after restore a record
forever Specifies that the cache should be valid forever
validForRestOfDay Specify that cache entity should be valid till end of day
validForRestOfWeek Specify that cache entity should be valid till end of week
ttl seconds (type: int) Specifies cache time to live in second
setDefault defaultValue (type: mixed) Specifies default value for the case that cache entity doesn't have any value
cache Closure Main part of each cache entity. defines cache content

Disable/Enable Cache

If you want to disable/enable cache, you can do it in the following two ways:

Disable

Enable

Update Cache Manually

Sometimes you want to update cache entities manually.

Update an Entity

Update all Entities

Update all LaraCache Entities

This will update all cache entities that stored using LaraCache (across all models)

Delete Cache Manually

Sometimes you want to delete cache entities manually. using these methods, you can do it.

Delete an Entity

Using this feature, you can delete cache entities temporary. after spending ttl, cache entity will be generated again.

Delete an Entity Forever

Using this feature, you can delete cache entities permanently. Cache item will be deleted forever and whenever you try to retrieve it, you will get null (or default value).

Note: Cache Entity will update after creating or updating records in your model

Delete all Model Entities

Delete all Model Entities Forever

Delete all LaraCache Entities

This will delete all cache entities that stored using LaraCache (across all models)

Artisan Commands

This feature allows you to update or delete multiple cache entities of one or more models from the console command. This means you can programmatically control the cache data outside the caching cycle.

You can also create groups of models and their entities in the config file and easily update or delete all their entities at once.

Update Cache

Delete Cache

Note: If you don't specify any entity, all entities will be operated.

Note: If you specify multiple models, you can't specify any entity and all entities of all models will be operated.

Group Operations

This is an example of a group configuration:

Laravel Nova Support

Nova LaraCache is a powerful Laravel Nova package that extends the functionalities of LaraCache by integrating it seamlessly with Laravel Nova. It provides an intuitive interface within the Laravel Nova administration panel, allowing users to effortlessly moderate and manage cache entities.

With Nova LaraCache, users can conveniently monitor cache expiration dates, review cache entity contents, regenerate cache items, and delete specific cache entries.

To unlock the cache management capabilities provided by Nova LaraCache, please refer to the installation instructions and consult the LaraCache documentation for guidance on creating cache entities for each model.

Config Properties

method Type description
driver string (default: null) The default mechanism for handling cache storage.
If you keep this option null, LaraCache will use the default cache storage from config/cache.php
laracache-list string (default: laracache.list) LaraCache uses a separate list to store name of all entities. using these keys, we can perform some actions to all entities (such as update or delete them)
first-day-of-week integer (default: 0) In some regions, saturday is first day of the week and in another regions it may be different. you can change the first day of a week by changing this property
last-day-of-week integer (default: 6) In some regions, friday is last day of the week and in another regions it may be different. you can change the last day of a week by changing this property
queue.status bool (default: false) Sometimes caching process is very heavy, so you have to queue the process and do it in background.
queue.name string (default: default) You have the option to set custom name for the queue process. This name will be used when invoking the onQueue method while dispatching the queue job.
queue.connection string (default: null) You have the option to set custom connection for the queue process. This connection will be used when invoking the onConnection method while dispatching the queue job.
groups array (default: []) You can group some entities and perform some operations on them

Complete Example


I am on an open-source journey 🚀, and I wish I could solely focus on my development path without worrying about my financial situation. However, as life is not perfect, I have to consider other factors.

Therefore, if you decide to use my packages, please kindly consider making a donation. Any amount, no matter how small, goes a long way and is greatly appreciated. 🍺

Donate


License

This software is released under The MIT License (MIT).


All versions of laracache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
laravel/framework Version ^8.40.0|^9.0|^10.0|^11.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 mostafaznv/laracache contains the following files

Loading the files please wait ....