Download the PHP package kodus/file-cache without Composer

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

kodus/file-cache

PHP Version Build Status Code Coverage Scrutinizer Code Quality

This library provides a minimal PSR-16 cache-implementation backed by simple file-system storage.

This can be used to provide working, lightweight bootstrapping when you want to ship a project that works out of the box, but doesn't depend on an awesome, full-blown caching-framework.

Strategy

Files are stored in a specified cache-folder, with two levels of sub-folders to avoid file-system limitations on the number of files per folder. (This will probably work okay for entry-numbers in the tens of thousands - if you're storing cache-entries in the millions, you should not be using a file-based cache.)

To reduce storage overhead and speed up expiration time-checks, the file modification time will be set in the future. (The file creation timestamp will reflect the time the file was actually created.)

Usage

Please refer to the PSR-16 spec for the API description.

Security

In a production setting, consider specifying appropriate $dir_mode and $file_mode constructor-arguments for your hosting environment - the defaults are a typical choice, but you may be able to tighten permissions on your system, if needed.

Garbage Collection

Because this is a file-based cache, you do need to think about garbage-collection as it relates to your use-case.

This cache-implementation does not do any automatic garbage-collection on-the-fly, because this would periodically block a user-request, and garbage-collection across a file-system isn't very fast.

A public method cleanExpired() will flush expired entries - depending on your use-case, consider these options:

  1. For cache-entries with non-dynamic keys (e.g. based on primary keys, URLs, etc. of user-managed data) you likely don't need garbage-collection. Manually clearing the folder once a year or so might suffice.

  2. For cache-entries with dynamic keys (such as Session IDs, or other random or pseudo-random keys) you should set up a cron-job to call the cleanExpired() method periodically, say, once per day.

For cache-entries with dynamic keys in the millions, as mentioned, you probably don't want a file-based cache.


All versions of file-cache with dependencies

PHP Build Version
Package Version
Requires php Version >= 8.0
psr/simple-cache Version ^2||^3
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 kodus/file-cache contains the following files

Loading the files please wait ....