定制 pstaender/silverstripe-redis-cache 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

pstaender/silverstripe-redis-cache

最新稳定版本:v0.0.3

Composer 安装命令:

composer require pstaender/silverstripe-redis-cache

包简介

Enables Redis cache for SilverStripe

README 文档

README

Enables usage of redis cache for SilverStripe.

status

Requirements

  • SilverStripe v4 / v5
  • Redis
  • Tested on PHP 7.3+

Pre-install

Ensure you have redis installed in your environment and configured within your php ini files to ensure PHP knows where to access Redis.

To install Redis, a quick Google with your OS name and version, your PHP version, and server and it's version that your're working with (E.G. Apache or NGINX) should yield a number of installation instructions such as this installation instruction example.

Add the following to your php.ini or conf.d/{your-custom-php-config-file}.ini to let PHP know where to communicate with Redis to store session data: Note: Missing this step will lead to login issues when working with providers such as AWS where you have your site running on multiple pods but need sessions to be unified across them.

session.save_handler = redis session.save_path = {your_redis_url} 

Installation and usage

Use composer to pull this module into your project:

 $ composer require pstaender/silverstripe-redis-cache 

To enable Redis cache in your SilverStripe project, add one or both of the following yaml configs to your project under /app/_config/ in either their own yaml file, or in an existing file such as mysite.yml.

Note: The REDIS_URL must be the url of the used redis instance, e.g. tcp://127.0.0.1:6379.

Usage in your project

--- Name: silverstripe-redis-cache After: - '#corecache' - '#assetscache' Only: envvarset: REDIS_URL --- SilverStripe\Core\Injector\Injector: RedisClient: class: Predis\Client constructor: 0: '`REDIS_URL`' RedisCacheFactory: class: Zeitpulse\RedisCacheFactory constructor: client: '%$RedisClient' SilverStripe\Core\Cache\CacheFactory: '%$RedisCacheFactory' # vendor/silverstripe/assets/_config/assetscache.yml Psr\SimpleCache\CacheInterface.InterventionBackend_Manipulations: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.FileShortcodeProvider: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.ImageShortcodeProvider: factory: RedisCacheFactory # vendor/silverstripe/assets/_config/assetscache.yml Psr\SimpleCache\CacheInterface.Sha1FileHashingService: factory: RedisCacheFactory # vendor/silverstripe/cms/_config/cache.yml Psr\SimpleCache\CacheInterface.CMSMain_SiteTreeHints: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.SiteTree_CreatableChildren: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.SiteTree_PageIcons: factory: RedisCacheFactory # vendor/silverstripe/cms/_config/permissions.yml + # vendor/silverstripe/framework/_config/cache.yml Psr\SimpleCache\CacheInterface.InheritedPermissions: factory: RedisCacheFactory # vendor/silverstripe/framework/_config/cache.yml Psr\SimpleCache\CacheInterface.cacheblock: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.VersionProvider_composerlock: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.RateLimiter: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.ThemeResourceLoader: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.DatabaseAdapterRegistry: factory: RedisCacheFactory Psr\SimpleCache\CacheInterface.EmbedShortcodeProvider: factory: RedisCacheFactory

Usage with flysystem asset storage

--- Name: silverstripes3-flysystem-redis Only: envvarset: - REDIS_URL After: - '#silverstripes3-flysystem' --- SilverStripe\Core\Injector\Injector: League\Flysystem\Cached\Storage\Memory.public: class: League\Flysystem\Cached\Storage\Predis League\Flysystem\Cached\Storage\Adapter.public: class: League\Flysystem\Cached\Storage\Predis League\Flysystem\Cached\Storage\Adapter.protected: class: League\Flysystem\Cached\Storage\Predis

Licence

MIT

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固