承接 aequasi/cache-bundle 相关项目开发

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

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

aequasi/cache-bundle

最新稳定版本:3.0.2

Composer 安装命令:

composer require aequasi/cache-bundle

包简介

Creates services in Symfony 2, for cache, that can also be used with doctrines three cache types. It also provides functionality for session handler support, and Router support.

README 文档

README

This bundle has been replaced by PHP-Cache. Check it out!

Aequasi cache-bundle Build Status

Cache Bundle for Symfony 2

Creates services in Symfony 2, for cache, that can also be used with doctrines three cache types (metadata, result, and query). It also provides functionality for session handler support, and Router support.

The respective cache extensions will be required for your project.

Redis uses the php redis extension.

Requirements

  • PHP >= 5.6, < 7.1
  • Symfony >= 2.7, < 4.0
  • Composer

To Install

Run the following in your project root, assuming you have composer set up for your project

composer.phar require aequasi/cache-bundle

Add the bundle to app/AppKernel.php

$bundles(
    ...
       new Aequasi\Bundle\CacheBundle\AequasiCacheBundle(),
    ...
);

Then add parameters (probably in config.yml) for your servers, and options

aequasi_cache:
    instances:
        default:
          persistent: true # Boolean or persistent_id
          namespace: mc
          type: memcached
          hosts:
              - { host: localhost, port: 11211 }

To see all the config options, run php app/console config:dump-reference aequasi_cache to view the config settings

Doctrine

This bundle allows you to use its services for Doctrine's caching methods of metadata, result, and query.

If you want doctrine to use this as the result and query cache, add this

aequasi_cache:
    doctrine:
        enabled: true
        metadata:
            instance: default
            entity_managers:   [ default ]          # the name of your entity_manager connection
            document_managers: [ default ]       # the name of your document_manager connection
        result:
            instance: default
            entity_managers:   [ default, read ]  # you may specify multiple entity_managers
        query:
            instance: default
            entity_managers: [ default ]

Session

This bundle even allows you to store your session data in one of your cache clusters. To enable:

aequasi_cache:
    session:
        enabled: true
        instance: default
        prefix: "session_"
        ttl: 7200

Router

This bundle also provides router caching, to help speed that section up. To enable:

aequasi_cache:
    router:
        enabled: true
        instance: default

If you change any of your routes, you will need to clear all of the route_* keys in your cache.

To Use

To use this with doctrine's entity manager, just make sure you have useResultCache and/or useQueryCache set to true. If you want to use the user cache, just grab the service out of the container like so:

// Change default to the name of your instance
$cache = $container->get( 'aequasi_cache.instance.default' );
// Or
$cache = $container->get( 'aequasi_cache.default' );

Here is an example usage of the service:

$cache = $this->get( 'aequasi_cache.instance.default' );
$item = $cache->getItem('test');
if ($item->isHit()) {
	var_dump($item->get());
	
	return;
}

$cache->saveItem('test', $em->find('AcmeDemoBundle:User', 1), 3600);

Need Help?

Create an issue if you've found a bug, or ping me on twitter: @aequasi

aequasi/cache-bundle 适用场景与选型建议

aequasi/cache-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 152.75k 次下载、GitHub Stars 达 35, 最近一次更新时间为 2013 年 12 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 35
  • Watchers: 9
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: Apache
  • 更新时间: 2013-12-06