定制 stfalcon-studio/doctrine-redis-cache-bundle 二次开发

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

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

stfalcon-studio/doctrine-redis-cache-bundle

Composer 安装命令:

composer require stfalcon-studio/doctrine-redis-cache-bundle

包简介

Add custom namespace for doctrine cache pools.

README 文档

README

📦 Add custom namespace for doctrine cache pools.

Scrutinizer Quality Score Build Status CodeCov License Latest Stable Version Total Downloads StyleCI

Problem Solved By This Bundle

When you use Redis as cache provider to store Doctrine query/metadata/result/second level cache, Doctrine generates unique keys for each cache item. When you change your database schema, create a new migration (Doctrine migration) and then deploy it to production, you have to clean your Doctrine cache after deploy. Doctrine has console commands to clean any type of cache and they work well. But if during the cache flushing, you have already running script (long running console/cron task or consumer) it still uses old schema info which can conflict with your new schema. In this case this script can regenerate cache (because it has been already flushed) with old schema metadata, query, result etc.

To prevent this problem, we add a custom namespace for each selected cache pool. This namespace is a name of the last migration version. For example, you deploy the first version of your project to production. Last migration version is 1 so all keys in cache will have prefix [1] (e.g. [1]hash_by_doctrine). Then you modify your schema, generate a new migration (version 2) and deploy it to production. Old running script will still use and generate keys with prefix [1], but new scripts will begin to use fresh prefix [2] and don't conflict with previous prefix.

After that you can stop or rerun old script. And after rerun they will use a new prefix and you can clean cache entries with the previous prefix.

Installation

composer req stfalcon-studio/doctrine-redis-cache-bundle

Check the config/bundles.php file

By default Symfony Flex will add this bundle to the config/bundles.php file. But in case when you ignored contrib-recipe during bundle installation it would not be added. In this case add the bundle manually.

# config/bundles.php

return [
    // Other bundles...
    StfalconStudio\DoctrineRedisCacheBundle\StfalconStudioDoctrineRedisCacheBundle::class => ['all' => true],
    // Other bundles...
];

Example of possible cache pool configuration

framework:
    cache:
        default_redis_provider: snc_redis.default
        pools:
            doctrine.result_cache_pool:
                adapter: cache.adapter.redis
                provider: snc_redis.doctrine_result_cache
            doctrine.metadata_cache_pool:
                adapter: cache.adapter.redis
                provider: snc_redis.doctrine_metadata_cache
            doctrine.query_cache_pool:
                adapter: cache.adapter.redis
                provider: snc_redis.doctrine_query_cache

Bundle configuration

stfalcon_studio_doctrine_redis_cache:
    cache_pools:
        - 'doctrine.query_cache_pool'
        - 'doctrine.metadata_cache_pool'
        - 'doctrine.result_cache_pool'

Contributing

Read the CONTRIBUTING file.

stfalcon-studio/doctrine-redis-cache-bundle 适用场景与选型建议

stfalcon-studio/doctrine-redis-cache-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 180.28k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2019 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「redis」 「symfony」 「cache」 「bundle」 「doctrine」 「cache pool」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 stfalcon-studio/doctrine-redis-cache-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 stfalcon-studio/doctrine-redis-cache-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 stfalcon-studio/doctrine-redis-cache-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-02