Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 30, 2024 via composer

psr/simple-cache 3.0.0

Common interfaces for simple caching
Package summary
Share
0
issues
1
license
1
MIT
Package created
4 Nov 2016
Version published
29 Oct 2021
Maintainers
3
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
psr/simple-cache@3.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of psr/simple-cache 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does psr/simple-cache do?

The PSR/Simple-Cache is a PHP composer package that provides common interfaces for simple caching. It abides by PSR-16 standards. Basically, it's not a standalone cache implementation, but an interface that outlines what caching implementation should look like. It standardizes cache interaction in PHP, which allows developers to shift between different caching solutions without a significant change in code.

How do you use psr/simple-cache?

Utilizing the PSR/Simple-Cache package is easy and straightforward. You include it in your project through composer, and then you can use it as stated by the PSR-16 caching interface.

For instance, to include the package in your project, you would use:

composer require psr/simple-cache

And a basic usage example might look like:

use Psr\SimpleCache\CacheInterface;

class MyClass
{
    private $cache;

    public function __construct(CacheInterface $cache)
    {
        $this->cache = $cache;
    }

    public function getItemFromCache($key)
    {
        if ($this->cache->has($key)) {
            return $this->cache->get($key);
        }

        // item does not exist in the cache.
        return null;
    }
}

Please note that PSR/Simple-Cache is just the interface for caching as per PSR-16 and you'll need an actual implementation for this to work.

Where are the psr/simple-cache docs?

All the documentation related to the PSR/Simple-Cache, including how it ties to the PSR-16 standard, can be found within the official specification file on the PHP-FIG GitHub. You can access it from the link provided in the README of the package at PSR-16 Simple Cache Specs.