Download the PHP package mfonte/redisw without Composer

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

Redisw: a Redis client for PHP, built on phpredis

CI Latest Stable Version Total Downloads PHP Version Require

An expressive, strictly-typed wrapper around the phpredis extension, designed for caching:

Requirements

Installation

Usage

Per-call TTL

PSR-16 (Simple Cache)

A null TTL applies the client's cache_ttl (including its jitter), and a TTL <= 0 deletes the item, as required by PSR-16. clear() deletes only the keys of the configured key_prefix; without a prefix, it flushes the current database.

TLS and ACL users

Caching with stale-while-revalidate

Setting force_revalidate to true (for example from a "refresh" request) makes has() and exists() return false, so that values are rebuilt and overwritten. getHits() and getMisses() count the results of has() / exists().

Configuration

Key Type Default Description
host string - Required. Hostname, IP address or unix socket path.
port int - Required. TCP port (use 0 for unix sockets).
connect_timeout float 0 Connection timeout, in seconds. 0 means no timeout.
connect_tries int 1 Number of connection attempts before giving up.
read_timeout float 0 Read timeout, in seconds. 0 uses the default_socket_timeout ini setting.
persistent bool false Use persistent connections (pconnect).
db_index int null Database to SELECT after connecting.
cache_ttl int 60 TTL, in seconds, applied to every write. 0 means no expiration.
cache_ttl_jitter bool true Add a random 10-99 seconds jitter to every TTL, to avoid cache stampedes.
auth string - Password for AUTH. auth_password is accepted as an alias.
username string - ACL username (Redis >= 6). Requires auth.
ssl bool false Connect over TLS.
ssl_context array [] SSL context options, used when ssl is true.
key_prefix string '' Prefix for every key. It is normalized to a lowercase slug (My App becomes my-app).
serializer string none One of none, php, igbinary, json, msgpack.
compression string none One of none, lzf, zstd, lz4 (availability depends on how phpredis was built).
force_revalidate bool false Make has(), exists() and allKeys() behave as if the database were empty.

Unknown keys and invalid values throw an InvalidArgumentException. Every option also has a fluent setter (setHost(), setCacheTTL(), ...) that can be called at any time: connection parameters drop the current connection, while the database, prefix, serializer and compression are applied to the live connection immediately.

Note: without a serializer, phpredis stores values as plain strings, so arrays and objects can't be stored. Use a serializer if you store anything other than strings and numbers. Conversely, incr(), decr() and append() work on raw values: don't use them on keys written by set() with a serializer.

API

Strings: get, set, mget, mset, setnx, msetnx, getset, incr, decr, append, strlen, getbit, setbit

Keys: exists, has, delete, deleteAll (keys of the current prefix), rename, renamenx, expire (milliseconds), expireat (unix timestamp), ttl (milliseconds), persist, allKeys, allValues

Sets: sadd, srem, spop, srandmember, scard, sismember, smembers, sdiffstore, sinterstore, sunionstore

Scripting: evaluate, evalSha

Server: dbSize, flushDb, flushAll, flushAllAsync, disconnect

allKeys() and allValues() use SCAN and MGET, so they don't block the server, but they still walk the whole database: avoid them on large datasets.

Exceptions

All exceptions extend Mfonte\Redisw\Exception\RedisException:

Exception Thrown when
RedisNotConfiguredException A command is run before host and port are configured.
RedisConnectionException The connection can't be configured (e.g. SELECT fails).
RedisTriesOverConnectException The connection failed connect_tries times (a RedisConnectionException).
RedisKeyNotFoundException get() is called on a missing key.
RedisImpossibleValueException Redis returns an unexpected reply (e.g. incr() on a non-integer).
RedisScriptExecutionException A Lua script fails.
Cache\CacheException A SimpleCache operation fails (implements PSR-16 CacheException).

Testing

The integration tests only use databases 15 and 14 (configurable through REDIS_DB and REDIS_DB_ALT). See CONTRIBUTING.md for details.

Changelog, contributing and security

Credits

A big thank you goes to alxmsl for the base implementation on alxmsl/Redis, and to ukko for the phpredis autocomplete stubs on ukko/phpredis-phpdoc, which made this package easier to write.

License

Released under the Apache License 2.0.


All versions of redisw with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-redis Version >=5.3
psr/simple-cache Version ^2.0 || ^3.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 mfonte/redisw contains the following files

Loading the files please wait ...