Download the PHP package apricity/micro-cache without Composer

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

Micro-Cache

Latest Stable Version PHP Version Require

MicroCache is a lightweight and simple in-memory caching solution that allows you to store key-value pairs in memory. It is particularly useful for caching data that is expensive to generate or retrieve from external sources.

Class provides a straightforward approach to caching data in memory, allowing for efficient storage and retrieval of cached items.

Installation

Table of contents

  1. Usage
    • API
      • MicroCache::set
      • MicroCache::get
      • MicroCache::delete
      • MicroCache::clear
      • MicroCache::has
    • Inheritance
  2. Tests
  3. Contributing
  4. Changelog
  5. License

MicroCache::set

Store an item in the cache.

This method stores an item in the cache under the specified key. If the key already exists, its value will be overwritten with the new value. If the TTL (time-to-live) parameter is provided and is greater than zero, the item will expire and be removed from the cache after the specified number of seconds. If the TTL is zero, the item will be cached indefinitely.

Parameters:

Returns: string|int - The key under which the item is stored.

Throws: InvalidArgumentException - If the key is callable or if the key is empty and not zero or false.

Example


MicroCache::get

Retrieve an item value from the cache.

This method retrieves the value of an item stored in the cache under the specified key. If the item exists in the cache and has not expired, its value will be returned. If the item does not exist or has expired, null will be returned.

Parameters:

Returns: mixed|null - The cached item value or null if the key doesn't exist or has expired.

Throws: InvalidArgumentException - If the key is callable or if the key is empty and not zero or false.

Example


MicroCache::delete

Delete an item from the cache.

This method removes the item stored in the cache under the specified key. If the item exists in the cache, it will be deleted. If the item does not exist, no action will be taken.

Parameters:

Returns: void

Throws: InvalidArgumentException - If the key is callable or if the key is empty and not zero or false.

Example


MicroCache::clear

Clear all items from the cache.

This method clears all items stored in the cache, effectively resetting the cache to an empty state.

Returns: void

Example


MicroCache::has

Check if an item exists in the cache and is not expired.

This method checks whether the specified key exists in the cache and if it is not expired. If the item exists and is not expired, it returns true; otherwise, it returns false.

Parameters:

Returns: bool - True if the item exists and is not expired, false otherwise.

Throws: InvalidArgumentException - If the key is callable or if the key is empty and not zero or false.

Example


Inheritance and creation of a unique cache

Shared cache

Unique cache


Run tests


Contributing

We welcome contributions from the community! For guidelines on how to contribute, please refer to the CONTRIBUTING.md file.


License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.


The repository has been migrated from GitLab.


All versions of micro-cache with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 apricity/micro-cache contains the following files

Loading the files please wait ....