ku匹配/密钥库

简单的密钥库值存储。

0.3.0 2014-01-17 08:09 UTC

This package is not auto-updated.

Last update: 2024-09-24 00:45:00 UTC


README

简单的密钥库值存储。

Build Status

安装

将 "kumatch/keystore" 添加到您的项目 composer.json 文件中的依赖项。

{
  "require": {
    "kumatch/keystore": "*"
  }
}

然后安装您的依赖项。

$ composer install

驱动程序

方法

use Kumatch\KeyStore\Storage;
use Kumatch\KeyStore\Filesystem\Driver;  // driver

__construct ($driver)

通过存储驱动创建存储实例。

$driver = new Driver("/tmp");
$storage = new Storage($driver);

write ($key, $value)

$key = "foo/bar";
$value = "Hello, world.";

$storage->write($key, $value);

append ($key, $value)

$key = "foo/bar";
$value = "Hello, world.";

$storage->append($key, $value);

read ($key)

$key = "foo/bar";
$value = $storage->read($key);
// returns a value of a key
// if key is not exists, returns null

exists ($key)

$key = "foo/bar";
$isExists = $storage->exists($key);
// returns boolean

remove ($key)

$key = "foo/bar";
$storage->remove($key);

import ($key, $filename)

$key = "foo/bar";
$filename = "/path/to/input.jpg";

$storage->import($key, $filename);

export ($key, $filename)

$key = "foo/bar";
$filename = "/path/to/output.jpg";

$storage->export($key, $filename);
// outputs a value to file path.

copy ($srcKey, $dstKey)

rename ($srcKey, $dstKey)

$src = "foo/bar";
$dst = "path/to/destination";

$storage->copy($src, $dst);

许可证

在 MIT 许可证下许可。

版权所有 (c) 2013 Yosuke Kumakura

在此前提下,任何人免费获得本软件及其相关文档文件(“软件”)的副本,可不受限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件的副本,并允许向获得软件的人提供软件以供其使用,前提是遵守以下条件

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定目的的适用性和非侵权性保证。在任何情况下,作者或版权所有者不对任何索赔、损害或其他责任负责,无论该索赔、损害或其他责任是基于合同、侵权或其他方式,是否因软件或其使用或其他交易而产生。