承接 ceeram/clear_cache 相关项目开发

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

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

ceeram/clear_cache

Composer 安装命令:

composer require ceeram/clear_cache

包简介

Clear CakePHP caches from shell, app or debug_kit panel

README 文档

README

ClearCache plugin provides several ways how to clear CACHE subfolders and cache engines in CakePHP applications.

Requirements

The master branch has the following requirements:

  • CakePHP 2.0 or greater.
  • PHP 5.3.0 or greater.

For CakePHP 1.3 use the 1.3 branch.

Installation

  • Clone/Copy the files in this directory into app/Plugin/ClearCache
  • Ensure the plugin is loaded in app/Config/bootstrap.php by calling CakePlugin::load('ClearCache');

Usage

Console Shell

Run from your APP folder:

# clear all cached files and configured engines
Console/cake ClearCache.clear_cache

# clear all cached files
Console/cake ClearCache.clear_cache files
# clear just files in CACHE folder
Console/cake ClearCache.clear_cache files .
# clear just files in CACHE subfolders
Console/cake ClearCache.clear_cache files *
# clear just files in CACHE/views folder
Console/cake ClearCache.clear_cache files views
# clear just files in selected CACHE subfolders
Console/cake ClearCache.clear_cache files models persistent

# clear all configured cache engines
Console/cake ClearCache.clear_cache engines
# clear just engine named _cake_core_
Console/cake ClearCache.clear_cache engines _cake_core_
# clear just selected engines
Console/cake ClearCache.clear_cache engines default sessions

# clear all configured cache groups
Console/cake ClearCache.clear_cache groups
# clear just cache group named comment
Console/cake ClearCache.clear_cache groups comment
# clear just selected groups
Console/cake ClearCache.clear_cache groups comment post

By default, running the shell will only display a total number of items cleaned. Use the -v flag to get list of items deleted:

# clear all cached files and configured engines
Console/cake ClearCache.clear_cache -v
# clear all cached files
Console/cake ClearCache.clear_cache files -v
# clear just engine named _cake_core_
Console/cake ClearCache.clear_cache engines _cake_core_ -v

Library Class

Similarly, run from your application code:

App::uses('ClearCache', 'ClearCache.Lib');
$ClearCache = new ClearCache();

$output = $ClearCache->run();

$output = $ClearCache->files();
$output = $ClearCache->files('.');
$output = $ClearCache->files('*');
$output = $ClearCache->files('views');
$output = $ClearCache->files('models', 'persistent');

$output = $ClearCache->engines();
$output = $ClearCache->engines('_cake_core_');
$output = $ClearCache->engines('default', 'custom');

$output = $ClearCache->groups();
$output = $ClearCache->groups('comment');
$output = $ClearCache->groups('comment', 'post');

Method files() returns an associative array of deleted/undeleted files:

array(
	'deleted' => array(...),
	'error'   => array(...)
)

Method engines() returns an associative array of result:

array(
	'default' => true,
	'_cake_core_'   => false
)

Method groups() returns an associative array of result:

array(
	'comment' => array(
		'default' => true,
	),
	'post' => array(
		'default' => true,
		'advanced' => true,
	),
)

Method run() returns an associative array of result:

array(
	'files' => array(
		'deleted' => array(...),
		'error'   => array(...)
	),
	'engines' => array(
		'default' => true,
		'_cake_core_'   => false
	)
)

Panel for DebugKit toolbar

In AppController, configure usage of ClearCache panel for DebugKit toolbar:

public $components = array(
	'DebugKit.Toolbar' => array(
		'panels' => array('ClearCache.ClearCache')
	)
);

Optionally, mainly for situations when debug is disabled and DebugKit is configured with 'forceEnable' => true, it is possible to restrict clearing of CACHE subfolders and cache engines/groups through DebugKit panel to specific items only (string or array of strings under folders/engines/groups keys) and/or enable every ones with special string all:

public $components = array(
	'DebugKit.Toolbar' => array(
		'panels' => array('ClearCache.ClearCache'),
		'clear_cache' => array(
			// allow to clear just files in CACHE/views folder
			'folders' => 'views'
			// allow to clear all cache engines at once, and selected ones separately
			'engines' => array('_all_', 'default', 'sessions'),
			// allow to clear all cache groups at once, and selected ones separately
			'groups' => array('_all_', 'comment', 'post'),
		)
	)
);

Clearing cache groups

Cache groups were introduced in CakePHP 2.2 and they are shared across all cache configs using the same engine and same prefix. Despite of this, ClearCache plugin clears WHOLE cache groups - even if they're specified in cache configurations with different cache engines and different prefixes.

ceeram/clear_cache 适用场景与选型建议

ceeram/clear_cache 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 125.27k 次下载、GitHub Stars 达 85, 最近一次更新时间为 2012 年 07 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 ceeram/clear_cache 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 125.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 86
  • 点击次数: 16
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 85
  • Watchers: 12
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-07-05