{"id":13549060,"url":"https://github.com/tedious/Stash","last_synced_at":"2025-04-02T22:31:16.518Z","repository":{"id":455813,"uuid":"1786482","full_name":"tedious/Stash","owner":"tedious","description":"The place to keep your cache.","archived":false,"fork":false,"pushed_at":"2024-03-04T17:09:44.000Z","size":1019,"stargazers_count":953,"open_issues_count":34,"forks_count":136,"subscribers_count":30,"default_branch":"main","last_synced_at":"2024-04-14T17:06:49.152Z","etag":null,"topics":["caching","php"],"latest_commit_sha":null,"homepage":"http://www.stashphp.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tedious.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"tedivm","tidelift":"packagist/tedivm/stash"}},"created_at":"2011-05-23T05:17:44.000Z","updated_at":"2024-05-05T08:36:20.405Z","dependencies_parsed_at":"2024-03-04T18:42:25.575Z","dependency_job_id":"a6ba7687-5c50-491f-9617-a97aa8a10e42","html_url":"https://github.com/tedious/Stash","commit_stats":{"total_commits":657,"total_committers":67,"mean_commits":9.805970149253731,"dds":0.289193302891933,"last_synced_commit":"a2c9df16c77b13e1f90462f30597a772166eea8f"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FStash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FStash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FStash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FStash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tedious","download_url":"https://codeload.github.com/tedious/Stash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246505984,"owners_count":20788595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caching","php"],"created_at":"2024-08-01T12:01:17.779Z","updated_at":"2025-04-02T22:31:16.483Z","avatar_url":"https://github.com/tedious.png","language":"PHP","funding_links":["https://github.com/sponsors/tedivm","https://tidelift.com/funding/github/packagist/tedivm/stash","https://tidelift.com/security","https://tidelift.com/subscription/pkg/packagist-tedivm-stash?utm_source=packagist-tedivm-stash\u0026utm_medium=referral\u0026utm_campaign=readme"],"categories":["Table of Contents","PHP","目录","缓存 Caching","类库"],"sub_categories":["Caching","缓存和锁定 Caching and Locking","Caching and Locking","缓存"],"readme":"# Stash - A PHP Caching Library\n\n[![License](http://img.shields.io/packagist/l/tedivm/stash.svg)](https://github.com/tedious/Stash/blob/master/LICENSE)\n[![Latest Stable Version](http://img.shields.io/github/release/tedious/stash.svg)](https://packagist.org/packages/tedivm/stash)\n[![Total Downloads](http://img.shields.io/packagist/dt/tedivm/stash.svg)](https://packagist.org/packages/tedivm/stash)\n\nStash makes it easy to speed up your code by caching the results of expensive\nfunctions or code. Certain actions, like database queries or calls to external\nAPIs, take a lot of time to run but tend to have the same results over short\nperiods of time. This makes it much more efficient to store the results and call\nthem back up later.\n\n## Installing\n\nInstalling Stash can be done through a variety of methods, although Composer is\nrecommended.\n\n### Composer\n\nUntil Stash reaches a stable API with version 1.0 it is recommended that you\nreview changes before Minor updates, although bug fixes will always be\nbackwards compatible.\n\n```js\n\"require\": {\n  \"tedivm/stash\": \"0.17.*\"\n}\n```\n\nor by using the `composer require` command:\n\n```\ncomposer require tedivm/stash\n```\n\n### Github\n\nReleases of Stash are available on [Github](https://github.com/tedious/Stash/releases).\n\n\n## Documentation\n\nAlthough this README contains some useful data there is a lot more information\nat the main site, [stashphp.com](http://www.stashphp.com/).\n\n\n## Core Concepts\n\n### Main Classes\n\nStash has three main components: a `Pool` class that represents a specific\ngrouping of cached objects, an `Item` class that provides access to individual\nobjects, and a series of `Driver` classes that allow Stash to interact with\ncaching systems.\n\nEach `Driver` is initialized and then passed into a `Pool`, at which point the\ndeveloper can simply forget about it. Developers also have the option of using\nmultiple Drivers together by joining them with the Composite Driver.\n\nThe `Pool` class allows developers to perform a number of tasks. There are a few\nmaintenance related tasks, such as running a \"Purge\" to allow backend systems to\nperform maintenance tasks or set new logging or driver classes. The `Pool` also\ncan be used to create `Item` objects, singly or in groups.\n\nEach `Item` represents a single object inside the cache. It has a unique Key,\nmeaning that any two Items created from the same `Pool` will contain the same\nValue. An `Item` can set, get and remove a value from a caching system.\n\n### Keys\n\nA Key is a string that represents an Item in a caching system. At its simplest,\na key is an alphanumeric string and has a one to one relationship with a value\nin the cache.\n\nStash provides a feature known as \"stacks\" that allows developers to group\nrelated Items together so they can be erased as a group. This is done by giving\nItems a nested structure, similar to folders on a computer. Just like with\nfolders, this is represented by adding slashes to the name representing the file\nor cached object.\n\nFor example, a Key like \"/models/users/34/profile\" can allow developers to clear\nthe data for specific users using that user's id, or clear the data for all\nusers or even all models. It can also allow that developer to break up data into\nspecific pieces to only load what is needed.\n\n### Session Storage\n\nThe provided Session class takes a Pool in its constructor and can then be\nregistered as a Session Handler using the built-in PHP methods, the\nSession::registerHandler static function, or by using any framework that uses\nthe SessionHandlerInterface interface.\n\n\n## Drivers\n\nStash currently supports the following backends:\n\n* FileSystem\n* Sqlite\n* APC\n* Memcached\n* Redis\n* Ephemeral (runtime only)\n\nStash also supports a specialized \"Composite\" Driver which can contain any\nnumber of the above drivers. This allows developers to created multi-tiered\ndrivers that use a variety of back ends.\n\n\n## Symfony Integration\n\nThe [Stash Bundle](https://github.com/tedious/TedivmStashBundle) makes using\nStash inside of Symfony projects significantly easier. This bundle exposes\nStash as a Service for developers to use, and allows Symfony to use Stash\nas a session handler.\n\n\n## License\n\nStash is licensed under the BSD License. See the LICENSE file for details.\n\n\n## Reporting Security and Vulnerability Issues\n\nThis project utilizes the [Tidelift Security Reporting System](https://tidelift.com/security) for security and vulnerability reporting. \n\n\n## Support\n\nIssues can be opened directly in Github for issues that aren't related to security.\n\n[Professionally supported Stash is now available with Tidelift.](https://tidelift.com/subscription/pkg/packagist-tedivm-stash?utm_source=packagist-tedivm-stash\u0026utm_medium=referral\u0026utm_campaign=readme)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedious%2FStash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftedious%2FStash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedious%2FStash/lists"}