Download the PHP package matomo/cache without Composer

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

Matomo/Cache

This is a PHP caching library based on Doctrine cache that supports different backends. At Matomo we developed this library with the focus on speed as we make heavy use of caching and sometimes fetch hundreds of entries from the cache in one request.

Build Status

Installation

With Composer:

Supported backends

Doctrine cache provides support for many more backends and adding one of those is easy. For example:

Please send a pull request in case you have added one.

Different caches

This library comes with three different types of caches. The naming is not optimal right now.

Lazy

This can be considered as the default cache to use in case you don't know which one to pick. The lazy cache works with any backend so you can decide whether you want to persist cache entries between requests or not. It does not support the caching of any objects. Only boolean, numbers, strings and arrays are supported. Whenever you request an entry from the cache it will fetch the entry from the defined backend again which can cause many reads depending on your application.

Eager

This cache stores all its cache entries under one "cache" entry in a configurable backend.

This comes handy for things that you need very often, nearly in every request. Instead of having to read eg. a hundred cache entries from files it only loads one cache entry which contains the hundred keys. Should be used only for things that you need very often and only for cache entries that are not too large to keep loading and parsing the single cache entry fast. This cache is even more useful in case you are using a slow backend such as a file or a database. Instead of having a hundred stat calls there will be only one. All cache entries it contains have the same life time. For fast performance it won't validate any cache ids. It is not possible to cache any objects using this cache.

Transient

This class is used to cache any data during one request. It won't be persisted.

All cache entries will be cached in a simple array meaning it is very fast to save and fetch cache entries. You can basically achieve the same by using a lazy cache and a backend that does not persist any data such as the array cache but this one will be a bit faster as it won't validate any cache ids and it allows you to cache any kind of objects. Compared to the lazy cache it does not support setting any life time as it will be only valid during one request anyway. Use this one if you read hundreds or thousands of cache entries and if performance really matters to you.

Usage

Creating a file backend

Creating a Redis backend

Creating a chained backend

Whenever you set a cache entry it will save it in the array and in the file cache. Whenever you are trying to read a cache entry it will first try to get it from the fast array cache. In case it is not available there it will try to fetch the cache entry from the file system. If the cache entry exists on the file system it will cache the entry automatically using the array cache so the next read within this request will be fast and won't cause a stat call again. If you delete a cache entry it will be removed from all configured backends. You can chain any backends. It is recommended to list faster backends first.

Creating a decorated backend with DefaultTimeout or KeyPrefix

Sometimes its useful to set default a default parameter for the timeout to force prevent infinite lifetimes, or to specify a key prefix to prevent different versions of the app from reading and writing the same cache entry.
DefaultTimeout and KeyPrefix are "decorators" that wrap another backend. Currently each takes a single configuration argument with the same name as the backend.

backend argument description
DefaultTimeout defaultTimeout Uses the integer value as the default timeout for defining cache entry lifetime. Only comes to effect when no lifetime is specified; Prevents infinite lifetimes.
KeyPrefix keyPrefix Prefixes the given value to the keys for any operation. For example 'Key123' would become 'SomePrefixKey123'

Creating a lazy cache

Description lazy cache.

Creating an eager cache

Description eager cache.

It will cache all set cache entries under the cache entry eagercache.

Creating a transient cache

Description transient cache.

License

The Cache component is released under the LGPL v3.0.

Changelog


All versions of cache with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
matomo/doctrine-cache-fork Version 1.10.4
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 matomo/cache contains the following files

Loading the files please wait ....