Download the PHP package since/redis without Composer

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

since/redis

一个基于PHP 8+的高性能Redis客户端库,提供连接池+门面模式和原始单例模式两种使用方式,支持Redis所有数据结构操作,包含完整的类型声明和异常处理机制。

特性

安装

使用Composer安装:

系统要求

使用方法

1. 门面模式(连接池)使用方式

门面模式是推荐的使用方式,它通过连接池管理Redis连接,适合高并发场景。

2. 单例模式使用方式

单例模式是传统的使用方式,适合简单场景:

支持的数据结构和操作

本库支持Redis的所有数据结构操作,通过不同的操作类提供:

数据结构 操作类 门面方法 描述
String StringOperation string() 字符串类型操作
Hash HashOperation hash() 哈希表类型操作
List ListOperation list() 列表类型操作
Set SetOperation set() 集合类型操作
SortedSet SortedSetOperation sortedSet() 有序集合类型操作
Geo GeoOperation geo() 地理空间类型操作
HyperLogLog HyperLogLogOperation hyperLogLog() 基数统计类型操作
Stream StreamOperation stream() 流类型操作
Key KeyOperation key() 键操作

连接池配置

连接池模式下的主要配置参数:

单例模式配置

单例模式下的主要配置参数:

异常处理

本库提供了完善的异常处理机制,使用时建议添加try-catch块捕获可能的异常:

最佳实践

  1. 高并发场景推荐使用门面模式(连接池):

    • 连接池能有效管理和复用连接资源
    • 避免频繁建立和关闭连接的开销
    • 控制最大连接数,防止连接耗尽
  2. 合理设置连接池参数:

    • 根据系统负载和Redis服务器性能设置max_connections
    • 适当设置timeout,避免连接等待时间过长
  3. 使用键前缀:

    • 在多项目或多环境共用Redis时,设置不同的键前缀避免键冲突
  4. 合理设置过期时间:

    • 对临时数据设置合适的过期时间,避免Redis内存占用过高
  5. 错误处理:
    • 始终使用try-catch捕获Redis操作可能抛出的异常
    • 考虑添加重试机制,处理临时性网络问题

性能优化

  1. 使用管道(Pipeline):

    • 对于批量操作,使用管道减少网络往返次数
  2. 合理使用事务:

    • 对需要原子性的操作,使用Redis事务
  3. 避免大键:
    • 尽量避免存储过大的值,影响Redis性能

版本历史

1.0.0

许可证

本项目使用MIT许可证 - 详见LICENSE文件

作者信息


All versions of redis with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-redis Version *
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 since/redis contains the following files

Loading the files please wait ...