Download the PHP package koded/cache-simple without Composer

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

Koded - Simple Caching Library

Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality Packagist Downloads Minimum PHP Version

A PSR-16 caching library for PHP 8 using several caching technologies. It supports JSON caching for Redis.

Requirements

The library is not tested on any Windows OS and may not work as expected there.

The recommended installation method is via Composer

Redis

There are two client flavors for Redis by using the

and they are not mutually exclusive.

These clients supports JSON serialization for the cache, useful for handling the cached data in other programming languages.

Since there is no Redis native support for JSON serialization, it's done in userland and that always introduces some overhead. Be aware that the native PHP and Igbinary functions are superior.

Memcached

Please install the Memcached extension.

Usage

The factory function always creates a new instance of specific SimpleCacheInterface client implementation.

A bit verbose construction for the same instance is

Configuration directives

Current available configuration classes

RedisConfiguration

Please refer to Redis extension connect method.

Parameter Value
host 127.0.0.1
port 6379
timeout 0.0
reserved null
retry 0

Serializers

The special config directive is binary(string) for setting the internal serializer functions to either PHP native un/serialize(), igbinary_un/serialize() or msgpack_un/pack().

The binary directive is effective if igbinary and/or msgpack extensions are installed and loaded. Otherwise it defaults to PHP un/serialize() functions.

You can change the binary flag on already cached data, but you should invalidate the previously cached items, since they are already serialized and stored in the cache.

JSON serializer options

The default options for json_encode() function are:

To set the desired options, use the options configuration directive:

JSON options are applied with bitmask operators. The above example will

MemcachedConfiguration

Memcached arguments Type Required Description
id string no Memcached persistent_id value
servers array no A list of nested array with [server, port] values
options array no A list of Memcached options
ttl int no Global TTL (in seconds)

The following options are set by default when an instance of MemcachedConfiguration is created, except for OPT_PREFIX_KEY which is there as a reminder that it may be set.

Memcached option Default value
OPT_DISTRIBUTION DISTRIBUTION_CONSISTENT
OPT_SERVER_FAILURE_LIMIT 2
OPT_REMOVE_FAILED_SERVERS true
OPT_RETRY_TIMEOUT 1
OPT_LIBKETAMA_COMPATIBLE true
OPT_PREFIX_KEY null

Options with NULL value will be removed.

There are many Memcached options that may suit the specific needs for the caching scenarios and this is something the developer/s needs to figure it out.

Examples:

PredisConfiguration

By default the parameters are:

Parameter Value
scheme tcp
host 127.0.0.1
port 6379

Examples:

There are many configuration options for this package. Please refer to Predis configuration page.

Shared Memory (shmop)

Requires a PHP shmop extension.

FileConfiguration

Please avoid it on production environments, or use it as a last option.

If cache directory is not provided in the configuration, the PHP function sys_get_temp_dir() is used to store the cached files in the OS "temporary" directory.

MemoryClient

This client will store the cached items in the memory for the duration of the script's lifetime. It is useful for development, but not for production.

MemoryClient is also the default client if you do not require a specific client in cache_simple_factory()

Code quality

or

Benchmarks

The benchmarks are flaky and dependant on the environment. This table gives a non-accurate insight how client performs at write-read-delete operations, and should have an informative comparison.

To find out what may be the fastest choice for your environment, run

License

The code is distributed under the terms of The 3-Clause BSD license.


All versions of cache-simple with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
koded/stdlib Version ^6.3
psr/simple-cache Version ^3.0
psr/log Version ^3
ext-json Version *
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 koded/cache-simple contains the following files

Loading the files please wait ....