2017 © Pedro Peláez
 

library storage

FastD php simple framework Storage Component

image

fastd/storage

FastD php simple framework Storage Component

  • Thursday, January 19, 2017
  • by JanHuang
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,564 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 14 Versions
  • 1 % Grown

The README.md

Storage

Building Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

简单的 PHP 存储类组件,支持原生 Memcached, Redis, SSDB 等操作。, (*2)

要求

  • PHP 7+

Composer

{
    "fastd/storage": "2.0.x-dev"
}

扩展

使用

都是简单的封装,实现统一一套 API,统一入口和基础 key/value 存储操作, (*3)

文件缓存

文件缓存此处仅使用最简单的 \SplFileObject 进行扩展,因为文件缓存样式以及支持的存储类型不是太过于丰富,所以此处仅作为最简单的 key/value 方式进行存储。, (*4)

$file = new File(__DIR__ . '/test.log');

$file->set('janhuang');

$content = $file->get();

通过 set 方法存储内容, 通过 get 方法获取存储的内容,具体操作请看 \SplFileObject,文件存储对象继承于 SplFileObject, (*5)

Redis

use FastD\Storage\Redis\Redis;

$redis = new Redis([
    'host' => '',
    'port' => '',
    'auth' => ''
]);

$redis->set($name, $value, $ttl = 0);

$redis->get($name);

获取 Redis 与原生对象,保持使用上的灵活。, (*6)

use FastD\Storage\Redis\Redis;

$redis = Redis::connect([
    'host' => '',
    'port' => '',
    'auth' => ''
]);

// 原生 redis 操作

$redis->mset($name, $value);

Redis::connection(array $config): \Redis 返回一个原生操作的扩展对象,可以然你按照原生的方式操作。, (*7)

Memcached

use FastD\Storage\Memcached\Memcached;

$memcached = new Memcached([
    'host' => '',
    'port' => ''
]);

$memcached->set('age', '18');

原生操作, (*8)

use FastD\Storage\Memcached\Memcached;

$memcached = Memcached::connect([
    'host' => '',
    'port' => ''
]);

SSDB

use FastD\Storage\Ssdb\Ssdb;

$ssdb = new Ssdb([
    'host' => '',
    'port' => ''
]);

原生操作, (*9)

use FastD\Storage\Ssdb\Ssdb;

$ssdb = Ssdb::connect([
    'host' => '',
    'port' => ''
]);

友情提示

所有缓存操作都实现 FastD\Storage\CacheInterface 接口,所以缓存操作保持一致,注意各个存储得兼容方式。 均使用 new 进行实例化。, (*10)

而原生操作均使用 FastD\Storage\StorageInterface::connect(array $config) 静态方法进行获取,文件存储较为特殊,只有 open 方法。, (*11)

友谊得小船不能说翻就翻, (*12)

Testing

phpunit

License MIT

The Versions

19/01 2017

2.0.x-dev

2.0.9999999.9999999-dev

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

19/01 2017

v2.0.1

2.0.1.0

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

19/01 2017

3.0.x-dev

3.0.9999999.9999999-dev

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JanHuang

storage fastd

02/08 2016

2.1.x-dev

2.1.9999999.9999999-dev

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

02/08 2016

dev-master

9999999-dev

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

02/08 2016

dev-psr7

dev-psr7

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

21/06 2016

v2.0.0

2.0.0.0

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

21/06 2016

v2.0.0-beta4

2.0.0.0-beta4

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

11/05 2016

v2.0.0-beta3

2.0.0.0-beta3

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

11/05 2016

v2.0.0-beta2

2.0.0.0-beta2

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

11/05 2016

v2.0.0-beta1

2.0.0.0-beta1

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Avatar JanHuang

storage fastd

27/11 2015

dev-dev

dev-dev

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Avatar JanHuang

storage fastd

22/08 2015

v0.1.1

0.1.1.0

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Avatar JanHuang

storage fastd

21/06 2015

v0.1.0

0.1.0.0

FastD php simple framework Storage Component

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Avatar JanHuang

storage fastd