Download the PHP package talesoft/tale-cache-core without Composer

On this page you can find all versions of the php package talesoft/tale-cache-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tale-cache-core

Packagist License CI Coverage

Tale Cache Core

What is Tale Cache Core?

Tale Cache Core is a basic extension of the PSR-6 and PSR-16 caching standards combined into a single library.

It acts as a base for libraries to be compatible to PSR-6 and PSR-16 caches without relying on heavy dependencies and also acts as a base for the Tale Cache library.

Furthermore, it tries to fix a single problem with the standard PSR cache specifications.

Installation

Usage

PSR-6 to PSR-16 adapter

Easily use PSR-6 cache pools in your applications or libraries preferring PSR-16 by using Tale\Cache\PoolCache

Null Cache and Runtime Cache for library authors

Sometimes library authors want to make their libraries caching compatible, but don't want to implement a whole caching implementation with it. While interfaces work really well for that, they can only be represented as optional dependencies, when sometimes what you really want is a required dependency on a cache or test against a mocked implementation. A real implementation also avoids needing to make your properties nullable or do null-checks on optional dependencies all the time, so you avoid a lot of defensive programming with null checks

Tale Cache Core provides two lightweight, simple implementations of a PSR-6 cache pool that can be used as default values and work like normal caches, just that they don't really do anything

Imagine a service that looks like this:

If you might want to test against this or instantiate it somewhere, you can either use the NullPool

This will basically just work like a completely disabled cache.

If you want to have some runtime caching so that cache items are not generated over and over again, you can also use the RuntimePool, which caches values as long as the process is there

If you still want optional dependencies, but you want to avoid defensive null-checks all over your library code, you can just default the value with a null-coalesce operator

Easy custom Cache Pool implementation

Tale Cache Core takes some of the work you require when wanting to write PSR-6 compatible cache pools. As an example we will implement an own file cache with Tale Cache Core:

now you have a fully valid PSR-6 cache working with files

Interoperable Cache Items

Tale Cache Core extends the normal PSR-6/16 interfaces and adds a single method that provides the ability to have a single CacheItem implementation for all possible CachePools

New interfaces to code against (All are PSR-6/16 compatible):

Psr\SimpleCache\CacheInterface   => Tale\CacheInterface
    | No new methods

Psr\Cache\CacheItemPoolInterface => Tale\Cache\PoolInterface
    | getItem($key): Tale\Cache\ItemInterface (type narrowing)

Psr\Cache\CacheItemInterface     => Tale\Cache\ItemInterface
    | getExpirationTime(): ?DateTimeInterface

As you can see, the Tale\Cache\ItemInterface provides a single new method to the interfaces, which allows us to retrieve the specified expiration time of a cache item. This allows the Tale\Cache\ItemInterface to be absolutely interoperable between different Item Pool implementations.

You can move items from one pool to another:

This is possible because the Cache Item can finally be a normal DTO and doesn't need its pool to set its expiration time, the cached value is stored inside the item along with its key and TTL, so it can always be moved or copied to other item pools.


All versions of tale-cache-core with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
psr/cache Version ^1.0
psr/simple-cache Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package talesoft/tale-cache-core contains the following files

Loading the files please wait ....