Download the PHP package roolith/cache without Composer

On this page you can find all versions of the php package roolith/cache. 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 cache

roolith-cache

PSR-6 and PSR-16 compatible cache system using PHP. Only the file driver is available. Any unknown driver name falls back to the file driver.

Install

Requirements

Bootstrap cache directory

Define ROOLITH_CACHE_DIR before vendor/autoload.php is loaded and before the first CacheFactory call. This order keeps the constant visible to the factory resolver at runtime. If you cannot define a constant early, set CacheFactory::$fileDriverCacheDir before use or pass an explicit ['dir' => ...] config. When no dir is configured, the factory falls back to sys_get_temp_dir() . '/roolith-cache'. FileDriver itself is strict. Calling bootstrap() without a non-empty string dir throws InvalidArgumentException.

Explicit config always wins over the constant and over the static override. The static override wins over the constant and over the temp fallback.

Usage

You may choose any method. All dir values must be non-empty strings, otherwise FileDriver::bootstrap() throws InvalidArgumentException.

Method 1: Factory

Method 2: Cache

Method 3: PSR-6

Pool::getItems() preserves input keys in the returned array. Pool::save() without an explicit expiration falls back to the item default, which is one month from creation.

Method 4: PSR-16

SimpleCache::getMultiple() preserves input keys in the returned array. Bulk methods accept arrays or Traversable and validate every key. Invalid keys throw PSR-16 InvalidArgumentException.

TTL semantics

Cache::put($key, $value, $expireAfter = 3600) takes seconds and defaults to one hour. Item::expiresAfter() accepts an integer in seconds, a DateInterval as a total duration via Carbon::now()->add(), or null for the item default. Item::expiresAt() accepts a DateTimeInterface or null for the item default. Item defaults to one month from construction, and Pool::save() re-applies that default when expiration is null. SimpleCache::set() uses a 5-hour default when TTL is null (SimpleCache::DEFAULT_TTL_HOURS). An integer TTL is seconds, a DateInterval TTL is added as a total duration, and zero or negative integers expire immediately. Any other TTL type such as string, float, bool, array, or object throws PSR-16 InvalidArgumentException. setMultiple() validates TTL before writing so an invalid TTL fails without partial writes.

Hits, falsy values, and expiration

Item::isHit() returns an explicit hit flag, not value truthiness. Falsy values 0, false, null, [], and '' round-trip with isHit() === true while unexpired. Missing, expired, corrupt, tampered, empty, or object-payload entries return isHit() === false for PSR-6 and false or $default for PSR-16 and FileDriver::get(). FileDriver::has() checks both payload validity and expiration. FileDriver::get() checks validity before expiration and returns false for invalid or expired payloads. There is no lingering falsy-value caveat. If you see a miss for a falsy value, the entry is actually missing or expired.

Storage details

Keys are mapped to safe-prefix + '-' + sha1(full-key) + '.' + ext. The prefix keeps the first 32 safe characters for readability, while the SHA1 prevents foo/bar versus foo-bar versus FOO-BAR collisions. The ext config is whitelisted to alphanumeric only and falls back to rcache. Payloads store expiration as a Unix timestamp and use unserialize() with allowed_classes => false. Tampered, empty, object-payload, or bad-shape payloads fail validation and read as miss. Writes are atomic via temp file plus LOCK_EX plus rename(), and reads use a shared lock. flush() only deletes *.<ext> files, skips dot entries and directories, and checks is_file() before unlink().

Drivers

Only the file driver is implemented. Cache::driver() switches on 'file' with a default branch, so unknown names currently fall back to FileDriver instead of throwing. Pass ['dir' => $dir] and optionally ['ext' => $ext] when constructing FileDriver directly.

Development


All versions of cache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
psr/cache Version ^1.0 || ^2.0 || ^3.0
nesbot/carbon Version ^2.0 || ^3.0
psr/simple-cache Version ^1.0 || ^2.0 || ^3.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 roolith/cache contains the following files

Loading the files please wait ...