Download the PHP package kylin987/webman-thinkorm-redis-cache without Composer

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

基于webman的跨项目共享数据缓存的composer包

此包仅适用于webman框架+thinkorm使用,同时提供适用于thinkphp6的包点这里

安装

使用

1、引入:

2、配置:

第 1 步:插件配置(自动生成,无需手动新建)

composer 安装本包时,会自动把内置配置拷贝到 config/plugin/kylin987/webman-thinkorm-redis-cache/ 目录,webman 会自动加载,目录结构:

其中 config.php 默认内容:

如需修改默认值,直接编辑 config/plugin/kylin987/webman-thinkorm-redis-cache/config.php 即可。

第 2 步:配置 redis 缓存连接

config.php 里的 cache_store(默认 ormCache)必须对应 config/redis.php 里的一个连接名。 在 config/redis.php 中新增名为 ormCache 的连接:

注意:连接名必须与 cache_store 保持一致。若想改用其它连接名(如 default), 需同步把 config.php 里的 cache_store 改成同一个名字。

第 3 步:启动项(自动注册,无需手动操作)

本包通过插件 bootstrap.php 自动注册启动类,进程启动时会自动给 think-orm 注入 redis 缓存, 无需再复制启动文件或修改 config/bootstrap.php。

升级迁移(老项目兼容)

本包从旧版配置(手动改 config/thinkorm.php + 复制 support/boot/ThinkOrm.php + 在 config/bootstrap.php 注册 \support\boot\ThinkOrm::class)迁移到插件配置体系时, 采用「增量迁移」,不会破坏老项目的运行。

兼容优先级

配置读取顺序为:config('thinkorm.cache_*') 优先,旧值不存在时才读取插件配置。 因此老项目升级后,即使不做任何迁移,也会继续使用原来的 Redis 连接与 TTL; 新项目则直接使用插件配置。

迁移步骤(可选,让老项目切到插件配置体系)

  1. 删除 config/bootstrap.php 中的 \support\boot\ThinkOrm::class 一行;
  2. 删除 support/boot/ThinkOrm.php 文件;
  3. 把 config/thinkorm.php 中的 cache_store / cache_exptime / cache_always 三项 复制到 config/plugin/kylin987/webman-thinkorm-redis-cache/config.php;
  4. 从 config/thinkorm.php 中删除这三项(可选,删除后即完全切到插件配置)。

完成以上步骤后,插件 Bootstrap 会自动接管缓存注入。

说明:app.php 中的 enable 开关同样有效,设为 false 即可整体停用本插件的配置与启动项, 此时若仍保留旧版 thinkorm.* 配置,则继续走旧逻辑。

3、使用:

固定组合键缓存

模型可以把 cachePk 配置为多个字段。组合必须唯一,建议建立数据库联合唯一索引; 原来的单字段配置和调用方式不变。


All versions of webman-thinkorm-redis-cache with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/cache Version ^6.2 || ^7.0
psr/container Version ^1.1.1 || ^2.0
webman/think-orm Version ^1.1 || ^2.0
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 kylin987/webman-thinkorm-redis-cache contains the following files

Loading the files please wait ...