Download the PHP package jnilla/joomla-cache-helper without Composer

On this page you can find all versions of the php package jnilla/joomla-cache-helper. 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 joomla-cache-helper

joomla-cache-helper

A Joomla cache helper for easier usage.

This helper is build on top of the native Joomla cache support. We implemented a simpler API and added few extra features to make the helper practical.

Installation

Install using Composer:

Load the library using the Composer autoloader:

Basic Usage

Declaration:

Store data to cache:

Get data from cache:

The proxy method:

If the flag isValid is true you can use the cache item data safely.

The most practical way to work with this library is using the proxy method.

This methods works as 2 in 1 intermediary that get and updates the cache item automatically if needed.

How it works:

Example with remote data:

The lifetime is the time before a cache item is considered stale and needs to be updated.

It's useful to know that we can use the $lifetime argument as a request rate limit mechanism using a formula like this 60 seconds / number_of_request = lifetime. Example: For a rate limit of 10 requests per minute use: 60 seconds / 10 requests = 10 seconds.

Wait Mechanism

There is a wait mechanism that is useful for certain cases of use.

The methods get and proxy share the following argument:

Case 1:

5 users request remote data using the proxy method at the same time for the first time and the $wait is not 0.

The first user to use the proxy method triggers the isUpdading flag and everyone gets to wait for the remote fetch operation to finish. After this, everyone gets the same data at the same time.

Case 2:

5 users request remote data using the proxy method at the same time for the first time and the $wait is 0.

The first user to use the proxy method triggers the isUpdading flag and only this user gets to wait for the remote fetch operation to finish. Everyone else gets an empty cache item at the same time.

This case is useful if you don't want to lock everyone on a waiting period the firt time the remote data is requested.

This behavior helps to aliviate server RAM usage because requests/CPU Threads live shorter.

Case 3:

5 users request remote data using the proxy method at the same time for the first time and the $wait is not 0, but the remote operation takes too long.

The first user to use the proxy method triggers the isUpdading flag and everyone gets to wait. If $wait time is reached the isUpdading flag is set to false, the isTimeout flag is set to true and everyone gets an empty cache item at the same time.

This prevents too long or infinite wait times for eveyone.

License

This project is under the MIT License.


All versions of joomla-cache-helper with dependencies

PHP Build Version
Package Version
No informations.
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 jnilla/joomla-cache-helper contains the following files

Loading the files please wait ....