codedgr/memory
Composer 安装命令:
composer require codedgr/memory
包简介
Store your data in ram, database, session and cookie.
README 文档
README
This library helps you to store temporary data in your memory, database, cookie or session. Use it to cache data to improve the speed of your script.
Install
Using Composer
"require": {
"codedgr/memory": "~1.0"
}
Store data to memory, session, database or cookie
Initialize the memory. Note that cookie does not need to initialized.
Ram::init();
Session::init();
Database::init($pdo);
Add data to the cache if the cache $key doesn't already exist. If it does exist, the data is not added and the function returns false.
Ram::add($key, $data, $expire);
Session::add($key, $data, $expire);
Database::add($key, $data, $expire);
Cookie::add($key, $data, $expire);
Add data to the cache. If the cache $key already exists, then it will be overwritten; if not then it will be created.
Ram::set($key, $data, $expire);
Session::set($key, $data, $expire);
Database::set($key, $data, $expire);
Cookie::set($key, $data, $expire);
Replaces the given cache if it exists, returns false otherwise.
Ram::replace($key, $expire, $group);
Session::replace($key, $expire, $group);
Database::replace($key, $expire, $group);
Cookie::replace($key, $expire, $group);
Get the value of the cached object, or false if the cache $key doesn't exist.
To disambiguate a cached false from a non-existing $key, you should do absolute testing of $found, which is passed by reference, against false: if $found === false, the key does not exist.
Ram::get($key, $expire, &$found = null);
Session::get($key, $expire, &$found = null);
Database::get($key, $expire, &$found = null);
Cookie::get($key, $expire, &$found = null);
Clears data from the cache for the given $key.
Ram::delete($key, $expire);
Session::delete($key, $expire);
Database::delete($key, $expire);
Cookie::delete($key, $expire);
Clears all cached data. Note that you can't flash the cookie memory.
Ram::flush();
Session::flush();
Database::flush();
codedgr/memory 适用场景与选型建议
codedgr/memory 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 06 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「cache」 「memory」 「cookie」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codedgr/memory 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codedgr/memory 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codedgr/memory 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
repository php library
Store your language lines in the database, yaml or other sources
PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-08