Download the PHP package dynamonet/redis without Composer
On this page you can find all versions of the php package dynamonet/redis. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dynamonet/redis
More information about dynamonet/redis
Files in dynamonet/redis
Package redis
Short Description Redis extension wrapper, with nice Lua-scripting support, and other helpful utilities
License MIT
Informations about the package redis
php-redis
A wrapper for the phpredis extension, with nice pipelining interfaces, Lua-scripting support, and other helpful utilities.
Install
Initialization
Pipelining
Redis 7 Functions
Redis 7 introduced the concept of "functions", which are named scripts, tipically written in Lua, which you invoke by the name you choose, like so:
Prior to Redis functions, the only way to invoke a custom script was using the SHA1 string returned by the LOAD SCRIPT
command :vomiting_face:
This library already has support for Redis 7 functions. All you have to do is register your functions, and then invoke them as if they were existing commands on the client.
Notice that associative array passed as the second argument. That argument is mandatory, and is the only way we have to tell the client which functions are exposed in the script, and how many key (mandatory) arguments have each of our custom functions.
Lua scripting
Lua scripts in Redis are like traditional database Stored Procedures, but on steroids, because you write them in Lua, so you may use conditionals, loops, and all the flow control structures available in the Lua language. The only downside of Redis scripting (if your are using any version older than 7) is having to use a SHA1 string to invoke your scripts. Fortunately, this library will make your Lua scripting much more pleasant.
Recomended use: have your Lua scripts in separate .lua files, load them to your client, and assign each script an alias:
All versions of redis with dependencies
ext-redis Version ^5.1