2017 © Pedro Peláez
 

library swoft-entity-cache

Swoft 模型实体缓存

image

limingxinleo/swoft-entity-cache

Swoft 模型实体缓存

  • Wednesday, July 18, 2018
  • by limingxinleo
  • Repository
  • 1 Watchers
  • 3 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

swoft-entity-cache

Swoft 模型实体缓存, (*1)

Build Status, (*2)

环境变量

# 实体缓存超时时间
ENTITY_CACHE_TTL=3600
# 模型缓存前缀
ENTITY_PREFIX=prefix

使用

config/properties/app.php中增加对应自定义组件, (*3)

return [
    ...
    'components' => [
        'custom' => [
            'Swoftx\\Db\\Entity\\',
        ],
    ],
];

修改实体基类,增加ModelCacheable Trait, (*4)

<?php
/**
 * Swoft Entity Cache
 *
 * @author   limx <715557344@qq.com>
 * @link     https://github.com/limingxinleo/swoft-entity-cache
 */
namespace App\Models;

use Swoft\Db\Model;
use Swoftx\Db\Entity\ModelCacheable;

class ModelCache extends Model
{
    use ModelCacheable;
}

调用, (*5)

<?php
// 从Redis中拿模型实体
$user = User::findOneByCache(1);

The Versions

18/07 2018

dev-master

9999999-dev

Swoft 模型实体缓存

  Sources   Download

MIT

The Requires

 

The Development Requires

by 李铭昕

php model db swoole swoft

17/07 2018

1.0.2

1.0.2.0

Swoft 模型实体缓存

  Sources   Download

MIT

The Requires

 

The Development Requires

by 李铭昕

php model db swoole swoft