{"id":15880002,"url":"https://github.com/tedious/tedivmstashbundle","last_synced_at":"2025-04-04T20:14:13.979Z","repository":{"id":2490005,"uuid":"3463938","full_name":"tedious/TedivmStashBundle","owner":"tedious","description":"Symfony Bundle for the Stash Caching Library","archived":false,"fork":false,"pushed_at":"2023-05-24T12:57:31.000Z","size":291,"stargazers_count":84,"open_issues_count":17,"forks_count":45,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-04T09:02:34.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.stashphp.com/Symfony.html","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","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":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-02-16T21:01:11.000Z","updated_at":"2024-01-21T13:56:07.000Z","dependencies_parsed_at":"2023-07-06T11:16:32.902Z","dependency_job_id":null,"html_url":"https://github.com/tedious/TedivmStashBundle","commit_stats":{"total_commits":226,"total_committers":36,"mean_commits":6.277777777777778,"dds":0.4734513274336283,"last_synced_commit":"29832f88dadeef4953cddfd8297600ff72781bcd"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FTedivmStashBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FTedivmStashBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FTedivmStashBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedious%2FTedivmStashBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tedious","download_url":"https://codeload.github.com/tedious/TedivmStashBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242680,"owners_count":20907134,"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":[],"created_at":"2024-10-06T03:07:04.802Z","updated_at":"2025-04-04T20:14:13.959Z","avatar_url":"https://github.com/tedious.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TedivmStashBundle [![Build Status](https://secure.travis-ci.org/tedious/TedivmStashBundle.svg?branch=master)](http://travis-ci.org/tedious/TedivmStashBundle)\n\n[![License](http://img.shields.io/packagist/l/tedivm/stash-bundle.svg)](https://github.com/tedious/TedivmStashBundle/blob/master/LICENSE)\n[![Latest Stable Version](http://img.shields.io/github/release/tedious/TedivmStashBundle.svg)](https://packagist.org/packages/tedivm/stash-bundle)\n[![Coverage Status](http://img.shields.io/coveralls/tedious/TedivmStashBundle.svg)](https://coveralls.io/r/tedious/TedivmStashBundle?branch=master)\n[![Total Downloads](http://img.shields.io/packagist/dt/tedivm/stash-bundle.svg)](https://packagist.org/packages/tedivm/stash-bundle)\n\n\nThe **TedivmStashBundle** integrates the [Stash caching library](https://github.com/tedious/Stash) into Symfony, providing a\npowerful abstraction for a range of caching engines. This bundle provides a caching service, adds Stash information to\nthe Web Profiler toolbar, and adds integration for the Doctrine Common Cache library.\n\nBoth the bundle and Stash are licensed under the New BSD License. Please fork us on [Github](https://github.com/tedious/TedivmStashBundle)!\n\n## Installation ##\n\nAdd the bundle using composer, either by requiring it on the command line:\n\n```bash\ncomposer require tedivm/stash-bundle\n```\n\nor by adding it directly to your `composer.json` file:\n\n```json\n\"require\": {\n    \"tedivm/stash-bundle\": \"0.7.*\"\n}\n```\n\nAdd the bundle to `app/AppKernel.php`:\n\n```php\npublic function registerBundles()\n{\n    return array(\n        new Tedivm\\StashBundle\\TedivmStashBundle(),\n    );\n}\n```\n\nAnd then set the basic configuration in `app/config/config.yml`:\n\n```yaml\nstash: ~\n```\n\n## Usage ##\n\nJust fetch the default cache pool service:\n\n```php\n$pool = $this-\u003econtainer-\u003eget('stash');\n```\n\nOr a custom-defined cache pool:\n\n```php\n$pool = $this-\u003econtainer-\u003eget('stash.custom_cache');\n```\n\nThen you can use the cache service directly:\n\n```php\n$item = $pool-\u003egetItem($id, 'info'); // cache keys, more than one can be used\n\n$info = $item-\u003eget();\n\nif($item-\u003eisMiss())\n{\n    $info = loadInfo($id);\n    $item-\u003eset($userInfo, 60); // second parameter is TTL (in seconds or future \\Datetime object)\n}\n\nreturn $info;\n```\n\n(See the [Stash documentation](http://stash.tedivm.com/) for more information on using the cache service.)\n\n## Configuration ##\n\n### Default Cache Service ###\n\nTo get started quickly, you can define a single caching service with a single driver:\n\n```yaml\nstash:\n    drivers: [ FileSystem ]\n    FileSystem: ~\n```\n\nThis cache service will be registered as `stash.default_cache`, which will also be automatically aliased to `cache`.\n\n### Configuring Drivers ###\n\nYou can set the individual parameters of the cache driver directly in the configuration:\n\n```yaml\nstash:\n    drivers: [ FileSystem ]\n    FileSystem:\n        dirSplit: 3\n        path: /tmp\n```\n\n### Multiple Drivers ###\n\nIf you want to use multiple drivers in sequence, you can list them separately:\n\n```yaml\nstash:\n    drivers: [ Apc, FileSystem ]\n    Apc: ~\n    FileSystem:\n        path: /tmp\n```\n\nThe cache service will automatically be configured with a Composite driver, with the drivers queried in the specified\norder (for example, in this example, Apc would be queried first, followed by FileSystem if that query failed.)\n\n### In-Memory ###\n\nBy default, every cache service includes in-memory caching: during the lifetime of a single request, any values stored\nor retrieved from the cache service will be stored in memory, with the in-memory representation being checked before\nany other drivers. In some circumstances, however (such as long-running CLI batch scripts) this may not be desirable.\nIn those cases, the in-memory driver can be disabled:\n\n```yaml\nstash:\n    drivers: [ Apc ]\n    inMemory: false\n    Apc: ~\n```\n\n### Doctrine Adapter ###\n\nStash provides a Doctrine cache adapter so that your Stash caching service can be injected into any service that takes\na DoctrineCacheInterface object. To turn on the adapter for a service, set the parameter:\n\n```yaml\nstash:\n    drivers: [ Apc ]\n    registerDoctrineAdapter: true\n    Apc: ~\n```\n\nFor the default cache, the Adapter service will be added to the container under the name\n`stash.adapter.doctrine.default_cache`. You can use it anywhere you'd use a regular Doctrine Cache object:\n\n```yaml\ndoctrine:\n    orm:\n        metadata_cache_driver:\n            type: service\n            id: stash.adapter.doctrine.default_cache\n        query_cache_driver:\n            type: service\n            id: stash.adapter.doctrine.default_cache\n        result_cache_driver:\n            type: service\n            id: stash.adapter.doctrine.default_cache\n```\n\n### Session Adapter ###\n\nStash provides a session adapter to allow Symfony sessions to be stored directly inside the cache. To turn on the\nadapter, set the parameter:\n\n```yaml\nstash:\n    drivers: [ Apc ]\n    registerSessionHandler: true\n    Apc: ~\n```\n\nOnce it's enabled, enable it in the framework bundle and it will automatically be used:\n\n```yaml\nframework:\n    session:\n        handler_id: stash.adapter.session.default_cache\n```\n    \n### Logger ###\n\nStash supports PSR Compliant logging libraries, you can specify which library is used by passing the logger's\nservice name as a parameter:\n\n```yaml\nstash:\n\tdrivers: [ FileSystem ]\n\tlogger: logger\n\tFileSystem: ~ \n```\n\n### Multiple Services ###\n\nYou can also configure multiple services, each of which stores is entirely separate:\n\n```yaml\nstash:\n    caches:\n        first:\n            drivers: [ FileSystem ]\n            registerDoctrineAdapter: true\n            FileSystem: ~\n        second:\n            drivers: [ Apc, FileSystem ]\n            inMemory: false\n            logger: logger\n            FileSystem: ~\n```\n\nEach service is defined with keys inside a separate, distinct internal namespace, so you can use multiple services to\navoid key collisions between distinct services even if you only have a single backend available.\n\nWhen multiple caches are defined, you can manually define a default, which will be aliased to the `stash` service:\n\n```yaml\nstash:\n    default_cache: first\n    first:\n        ...\n    second:\n        ...\n```\nIf you don't, the first service defined will be set as the default.\n\n### Tracking ###\n\nStashBundle includes a module which tracks the keys of all cache queries made during a request for debugging purposes.\nBy default this module is enabled in the `dev` and `test` environments but disabled elsewhere. However, if you want to \noverride the default behavior, you can enable or disable this behavior in the configuration:\n\n```yaml\nstash:\n    tracking: true # enables query logging, false to disable\n    tracking_values: true # enables query logging of full cache values, false to disable\n```\n\n## Stash Driver Configuration ##\n\nEach driver comes with a set of default options which can be individually overridden.\n\n```yaml\nFileSystem:\n    dirSplit:               2\n    encoder:                Native\n    path:                   %kernel.cache_dir%/stash\n    filePermissions:        0660\n    dirPermissions:         0770\n    memKeyLimit:            20\nSQLite:\n    path:                   %kernel.cache_dir%/stash\n    filePermissions:        0660\n    dirPermissions:         0770\n    busyTimeout:            500\n    nesting:                0\n    subdriver:              PDO\nApc:\n    ttl:                    300\n    namespace:              \u003cnone\u003e\nMemcache:\n    servers:\n        - { server: 127.0.0.1, port: 11211, weight: 1 }\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedious%2Ftedivmstashbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftedious%2Ftedivmstashbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedious%2Ftedivmstashbundle/lists"}