Download the PHP package sunchayn/strata without Composer

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


Latest Version on Packagist License PHP Version codecov Laravel versions

A feature-complete Laravel filesystem cache with tagged cache support.


Why Strata?

Laravel's built-in file cache driver has no tag support. Needing tags means opting in for a different driver or having some per env (e.g. prod vs local) logic to interact with the cache differently. Strata closes this gap, it is a drop-in replacement for the default filesystem driver with tagged cache support, isolated locks, and widened support for atomic operations.

Key Features

See tools/bench/output for the benchmark (vs Laravel Default Driver) details.

Installation

You can install the package via Composer:

You may publish the package's config with:

Requirements

Setup

Add a store that uses the strata driver to config/cache.php.

Then select it as the default store in your .env file, or use it by name in your code.

Usage

Strata follows the Laravel cache API.

Tags

Unlike the Laravel file driver, Strata supports tags.

A tag lets you group cache entries so you can invalidate them all at once, instead of tracking every individual key that needs to expire together. Attach the same tag to any number of values, then flush that one tag when the underlying data changes.

Note: Tag names must be valid UTF-8.

How tagging and eviction work

Strata does not run anything in the background to keep the cache clean. Everything happens in two steps:

  1. A flush rotates the tag IDs. tags(['books'])->flush() only marks the tag books as flushed adn rotate its internal unique ID. None of the value files stored under it are touched at that moment.
  2. Lazy eviction on reads. Every read first checks the value's expiration and its tags. If the value is expired, or one of its tags was flushed, then the value is evicted and is considered a cache miss.

Note: this design is similar to how the default file driver evicts expired values.

Cached value structure

Part Content
Line 1 Expiration time
Line 2 Tags, at the time the value was written
Rest of the file The cached value itself

Scheduling the tag files cleanup

Strata keeps one small file for each tag you have ever used, and never removes it on its own. Schedule the prune command to remove old tag files by adding this to routes/console.php.

The command will delete any tag that wasn't re-flushed in the last config('strata.tag_gc_ttl) seconds.

Atomic locks

Strata supports Cache::lock(). Locks are stored in a separate locks directory, so Cache::flush() does not release them.

You can use Cache::flushLocks() to flush all locks them.

Atomic Operations

Strata supports cache::add(), similar to the default file driver, to add an item if it doesn't exist (atomically).

It also provides atomic operations support to the following methods:

Configuration

Publish the configuration file, then edit config/strata.php.

Key Default Purpose
directory storage/framework/cache/strata Root directory of all Strata files.
tag_gc_ttl One month, in seconds Age after which the prune command deletes a tag file.
file_permission 0o755 Permission (octal value) of every file and directory Strata creates.

Links

License

Strata is an open-sourced software licensed under the MIT license.


All versions of strata with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^12.0||^13.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 sunchayn/strata contains the following files

Loading the files please wait ...