承接 amne/simple-cache-layers 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

amne/simple-cache-layers

最新稳定版本:v0.1

Composer 安装命令:

composer require amne/simple-cache-layers

包简介

PSR16 implementation that reads and writes to a layered cache built from other PSR16 implementations

README 文档

README

This is a PSR-16 implementation of a layered cache that is full of optimism. It assumes the cache is being used for speed and not for important things like throttling, sessions or things like that.

How?

Layers are also PSR-16 implementations. This means every method of the layered cache is delegated to all the layers depending on the desired outcome:

  • get() and getMultiple() will return a value from the first layer that has it. When a value is found in a "lower" layer it gets synced back up to all the "higher" layers
  • set() and setMultiple() will store a value in all the layers, starting from the "lowest" layer
  • a companion key suffixed with -layer-meta is created for all stored keys to keep track of creation time and first TTL. This information is used during sync back.
  • full of optimism: when things fail there is no rollback logic. If you set a key and it fails in a mid layer it just stops. This should be fine because set() starts with the lowest layer and the next get() will trigger a sync back

Why?

In a distributed context it can become a bottleneck to go out on the network to read a centralized cache all the time. Storing some information locally (in APC or even filesystem) with a short TTL should keep things going almost as fast as having everything cached only locally but still keep the control that a centralized cache like redis/memcache/couchbase gives you.

统计信息

  • 总下载量: 258
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-23