Download the PHP package crack9527/swoft-cache without Composer
On this page you can find all versions of the php package crack9527/swoft-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package swoft-cache
Swoft Cache
Swoft缓存组件
composer安装
- composer command
支持组件
- redis
- file
- memcached
使用方法
-
在配置文件
app/bean.php
里增加组件配置,如使用redis缓存 - 在需要使用缓存的地方,使用全局方法
cache()
,如下
或者通过注解注入对象属性里
缓存方法如下
设置缓存
如果设置成功返回true,否则返回false。
缓存自增
针对数值类型的缓存数据,可以使用自增操作,例如:
缓存自减
针对数值类型的缓存数据,可以使用自减操作,例如:
获取缓存
获取缓存数据可以使用:
cache()->get('name');
如果name值不存在,则默认返回 false。
支持指定默认值,例如:
cache()->get('name','');
表示如果name值不存在,则返回空字符串。
删除缓存
cache()->rm('name');
清空缓存
cache()->clear();
LICENSE
The Component is open-sourced software licensed under the Apache license.
All versions of swoft-cache with dependencies
PHP Build Version
Package Version
Requires
swoft/framework Version
~2.0.0
swoft/swoole-ide-helper Version ^4.4
swoft/redis Version ~2.0.0
swoft/swoole-ide-helper Version ^4.4
swoft/redis Version ~2.0.0
The package crack9527/swoft-cache contains the following files
Loading the files please wait ....