dracoblue/doctrine-cache-profile-storage

使用 Doctrine Cache 作为 Symfonys Web Profiler 的 ProfilerStorageInterface。

0.1.0 2018-11-17 20:45 UTC

This package is auto-updated.

Last update: 2024-09-18 09:25:17 UTC


README

默认情况下,symfony 的分析器将数据存储在文件存储中。如果您想使用 memcached 或 redis,则需要为它提供一个 ProfileStorageInterface。

此库为任何 Doctrine\Common\Cache\CacheProvider 提供了一个简单的 Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface

使用 Redis

给定

  1. REDIS_HOST 和 REDIS_PORT 已设置为环境变量。您也可以使用参数。
  2. 并且已经安装了 redis 扩展
  app.profiler.redis:
      class: \Redis
      calls:
        - [ pconnect, [ '%env(REDIS_HOST)%', '%env(REDIS_PORT)%' ]]

  app.profiler.redis_cache:
      class: Doctrine\Common\Cache\RedisCache
      calls:
        - [ setNamespace, [ "profiler-" ]]
        - [ setRedis, [ "@app.profiler.redis" ]]

  profiler.storage:
      class: DracoBlue\DoctrineCacheProfileStorage\DoctrineCacheProfileStorage
      arguments:
          - "@app.profiler.redis_cache"

使用 Memcached

给定

  1. MEMCACHED_HOST 和 MEMCACHED_PORT 已设置为环境变量。您也可以使用参数。
  2. 并且已经安装了 memcached 扩展
  app.profiler.memcached:
      class: \Memcached
      arguments:
        - "profiler"
      calls:
        - [ addServer, [ '%env(MEMCACHED_HOST)%', '%env(MEMCACHED_PORT)%' ]]

  app.profiler.memcached_cache:
      class: Doctrine\Common\Cache\MemcachedCache
      calls:
        - [ setMemcached, [ "@app.profiler.memcached" ]]

  profiler.storage:
      class: DracoBlue\DoctrineCacheProfileStorage\DoctrineCacheProfileStorage
      arguments:
          - "@app.profiler.memcached_cache"

许可证

此作品版权属于 DracoBlue(http://dracoblue.net)并许可在 MIT 许可证条款下。