intersvyaz/yii-tags-dependency 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

intersvyaz/yii-tags-dependency

Composer 安装命令:

composer require intersvyaz/yii-tags-dependency

包简介

Verification of the cache relevance based on Dependency mechanism of Yii framework and tags, which are also stored in cache

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage

Verification of the cache relevance based on Dependency mechanism of Yii framework and tags, which are also stored in cache

Based on idea of Косыгин Александр < http://habrahabr.ru/users/kosalnik/ > described at http://habrahabr.ru/post/159079/

Installation via Composer

php composer.phar require intersvyaz/yii-tags-dependency:*

Configuration

  1. This extension require configured cache

Base Usage

<?php

use Intersvyaz\Cache\TagsDependency;

$cache = \Yii::app()->cache;

// save any value into cache with this dependency
$cache->set('cacheKey', 'cacheValue', 0, new TagsDependency(['A', 'B']));

// check if there is a value in cache
var_dump($cache->get('cacheKey'));

// remove (invalidate) one or several tags
TagsDependency::clearTags(['A']);

// check if cached value is absent in cache
var_dump($cache->get('cacheKey'));

CacheTagBehavior usage

class TestActiveRecord extends \CActiveRecord
{
//    ...
    
    public function behaviors()
    {
        return [
            'cacheTagBehavior' => [
                'class' => CacheTagBehavior::class,
            ]
        ];
    }
    
//    ...
}

// in other code: 

$models = TestActiveRecord::model()->cacheTag(3600, $dependency)->findAll();

// ...

// read query from cache
$models = TestActiveRecord::model()->cacheTag(3600, $dependency)->findAll();

// ...
$model2 = TestActiveRecord::model()->findByPk(2);
$model2->title = 'test';
$model2->save();

// ...

// cache invalid, read query from db
$models = TestActiveRecord::model()->cacheTag(3600, $dependency)->findAll();

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 9
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固