keinos/mastodon-streaming-api-cache

简单的键值存储类。

1.0.0 2020-07-20 13:44 UTC

This package is auto-updated.

Last update: 2024-09-22 21:39:56 UTC


README

用于缓存的简单键值存储类

这是一个简单的键值存储PHP类,用于简单的目的,如缓存。

安装

composer require keinos/mastodon-streaming-api-cache

用法

<?php

namespace KEINOS\Sample;

require_once __DIR__ . '/../vendor/autoload.php';

// Instantiate
use KEINOS\MSTDN_TOOLS\Cache\Cache;
$cache = new Cache();

// Set value to the cache
$key   = 'foo';
$value = 'bar';
$cache->set($key, $value);

// Get value from the cache
$actual = $cache->get($key);
$expect = $value;
echo ($expect === $actual) ? 'OK' : 'NG', PHP_EOL;

// Delete value from the cache
$result = $cache->delete($key);

// Clear all the caches
$result = $cache->clear();

包信息