Repository: php-fig/simple-cache
Branch: master
Commit: 2d280c2aaa23
Files: 9
Total size: 8.0 KB
Directory structure:
gitextract_qqfm76ur/
├── .editorconfig
├── .gitattributes
├── .gitignore
├── LICENSE.md
├── README.md
├── composer.json
└── src/
├── CacheException.php
├── CacheInterface.php
└── InvalidArgumentException.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
================================================
FILE: .gitattributes
================================================
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.editorconfig export-ignore
/tests export-ignore
================================================
FILE: .gitignore
================================================
build
composer.lock
docs
vendor
================================================
FILE: LICENSE.md
================================================
# The MIT License (MIT)
Copyright (c) 2016 PHP Framework Interoperability Group
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
================================================
FILE: README.md
================================================
PHP FIG Simple Cache PSR
========================
This repository holds all interfaces related to PSR-16.
Note that this is not a cache implementation of its own. It is merely an interface that describes a cache implementation. See [the specification](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-16-simple-cache.md) for more details.
You can find implementations of the specification by looking for packages providing the [psr/simple-cache-implementation](https://packagist.org/providers/psr/simple-cache-implementation) virtual package.
================================================
FILE: composer.json
================================================
{
"name": "psr/simple-cache",
"description": "Common interfaces for simple caching",
"keywords": ["psr", "psr-16", "cache", "simple-cache", "caching"],
"license": "MIT",
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"require": {
"php": ">=8.0.0"
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
}
}
================================================
FILE: src/CacheException.php
================================================
<?php
namespace Psr\SimpleCache;
/**
* Interface used for all types of exceptions thrown by the implementing library.
*/
interface CacheException extends \Throwable
{
}
================================================
FILE: src/CacheInterface.php
================================================
<?php
namespace Psr\SimpleCache;
interface CacheInterface
{
/**
* Fetches a value from the cache.
*
* @param string $key The unique key of this item in the cache.
* @param mixed $default Default value to return if the key does not exist.
*
* @return mixed The value of the item from the cache, or $default in case of cache miss.
*
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function get(string $key, mixed $default = null): mixed;
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
*
* @param string $key The key of the item to store.
* @param mixed $value The value of the item to store, must be serializable.
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool;
/**
* Delete an item from the cache by its unique key.
*
* @param string $key The unique cache key of the item to delete.
*
* @return bool True if the item was successfully removed. False if there was an error.
*
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function delete(string $key): bool;
/**
* Wipes clean the entire cache's keys.
*
* @return bool True on success and false on failure.
*/
public function clear(): bool;
/**
* Obtains multiple cache items by their unique keys.
*
* @param iterable<string> $keys A list of keys that can be obtained in a single operation.
* @param mixed $default Default value to return for keys that do not exist.
*
* @return iterable<string, mixed> A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
*
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if $keys is neither an array nor a Traversable,
* or if any of the $keys are not a legal value.
*/
public function getMultiple(iterable $keys, mixed $default = null): iterable;
/**
* Persists a set of key => value pairs in the cache, with an optional TTL.
*
* @param iterable $values A list of key => value pairs for a multiple-set operation.
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if $values is neither an array nor a Traversable,
* or if any of the $values are not a legal value.
*/
public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool;
/**
* Deletes multiple cache items in a single operation.
*
* @param iterable<string> $keys A list of string-based keys to be deleted.
*
* @return bool True if the items were successfully removed. False if there was an error.
*
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if $keys is neither an array nor a Traversable,
* or if any of the $keys are not a legal value.
*/
public function deleteMultiple(iterable $keys): bool;
/**
* Determines whether an item is present in the cache.
*
* NOTE: It is recommended that has() is only to be used for cache warming type purposes
* and not to be used within your live applications operations for get/set, as this method
* is subject to a race condition where your has() will return true and immediately after,
* another script can remove it making the state of your app out of date.
*
* @param string $key The cache item key.
*
* @return bool
*
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if the $key string is not a legal value.
*/
public function has(string $key): bool;
}
================================================
FILE: src/InvalidArgumentException.php
================================================
<?php
namespace Psr\SimpleCache;
/**
* Exception interface for invalid cache arguments.
*
* When an invalid argument is passed it must throw an exception which implements
* this interface
*/
interface InvalidArgumentException extends CacheException
{
}
gitextract_qqfm76ur/
├── .editorconfig
├── .gitattributes
├── .gitignore
├── LICENSE.md
├── README.md
├── composer.json
└── src/
├── CacheException.php
├── CacheInterface.php
└── InvalidArgumentException.php
SYMBOL INDEX (11 symbols across 3 files)
FILE: src/CacheException.php
type CacheException (line 8) | interface CacheException extends \Throwable
FILE: src/CacheInterface.php
type CacheInterface (line 5) | interface CacheInterface
method get (line 18) | public function get(string $key, mixed $default = null): mixed;
method set (line 34) | public function set(string $key, mixed $value, null|int|\DateInterval ...
method delete (line 46) | public function delete(string $key): bool;
method clear (line 53) | public function clear(): bool;
method getMultiple (line 67) | public function getMultiple(iterable $keys, mixed $default = null): it...
method setMultiple (line 83) | public function setMultiple(iterable $values, null|int|\DateInterval $...
method deleteMultiple (line 96) | public function deleteMultiple(iterable $keys): bool;
method has (line 113) | public function has(string $key): bool;
FILE: src/InvalidArgumentException.php
type InvalidArgumentException (line 11) | interface InvalidArgumentException extends CacheException
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (9K chars).
[
{
"path": ".editorconfig",
"chars": 271,
"preview": "; This file is for unifying the coding style for different editors and IDEs.\n; More information at http://editorconfig.o"
},
{
"path": ".gitattributes",
"chars": 395,
"preview": "# Path-based git attributes\n# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html\n\n# Ignore all test and"
},
{
"path": ".gitignore",
"chars": 32,
"preview": "build\ncomposer.lock\ndocs\nvendor\n"
},
{
"path": "LICENSE.md",
"chars": 1137,
"preview": "# The MIT License (MIT)\n\nCopyright (c) 2016 PHP Framework Interoperability Group\n\n> Permission is hereby granted, free o"
},
{
"path": "README.md",
"chars": 563,
"preview": "PHP FIG Simple Cache PSR\n========================\n\nThis repository holds all interfaces related to PSR-16.\n\nNote that th"
},
{
"path": "composer.json",
"chars": 553,
"preview": "{\n \"name\": \"psr/simple-cache\",\n \"description\": \"Common interfaces for simple caching\",\n \"keywords\": [\"psr\", \"ps"
},
{
"path": "src/CacheException.php",
"chars": 173,
"preview": "<?php\n\nnamespace Psr\\SimpleCache;\n\n/**\n * Interface used for all types of exceptions thrown by the implementing library."
},
{
"path": "src/CacheInterface.php",
"chars": 4822,
"preview": "<?php\n\nnamespace Psr\\SimpleCache;\n\ninterface CacheInterface\n{\n /**\n * Fetches a value from the cache.\n *\n "
},
{
"path": "src/InvalidArgumentException.php",
"chars": 260,
"preview": "<?php\n\nnamespace Psr\\SimpleCache;\n\n/**\n * Exception interface for invalid cache arguments.\n *\n * When an invalid argumen"
}
]
About this extraction
This page contains the full source code of the php-fig/simple-cache GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (8.0 KB), approximately 2.1k tokens, and a symbol index with 11 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.