Download the PHP package eftec/cacheone without Composer

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

CacheOne

CacheOne is a cache class of service for php. It supports Redis, Memcache, PDO and/or APCU.

Unlikely other cache libraries, this library is based in group (optional). So it's suitable to invalidate a single key or an entire group of elements.

Packagist Total Downloads [Maintenance]() [composer]() [php]() [php]() [CocoaPods]()

Example

Table of Contents

Definitions

Creating a new instance of CacheOne

Creates a new connection using Redis (Redis is an on memory cache library)

Creates a new connection using apcu (APCU is an extension for PHP to cache content)

Creates a new connection using PdoOne (PdoOne is a library to connect to the database using PDO)

or you could use to create a PdoOne instance:

Creates a new connection using memcache (Memcache is an old, but it is still a functional memory cache server)

Creates a new connection using the class DocumentOne (file system)

This example requires the library eftec/documentstoreone

The library DocumentStoreOne works with concurrency.

or creating a new connection, using redis, memcache, apcu or documentone (it takes the first available)

Storing a value

function set($group, $key, $value, $duration = 1440): bool

It stores a value inside a group and a key. It returns false if the operation failed.

Note: The duration is ignored by "documentone"

Group is optional, and it could be used if we need to invalidate (delete) an entire group.

Getting a value

function get($group, $key, $defaultValue = false)

It gets a value stored in a group (optional) and key. If the value is not found then it returns false. Note: a false value could be a valid value.

setDefaultTTL

Pushing and Popping values form an array

push

It pushes (adds) a new value at the end of the array. If the array does not exist, then it is created a new array. This command allows to limit the numbers of elements of the array.

Syntax:

push($groups, $key, $value, $duration = null, $limit = 0, $limitStrategy = 'shiftold') : bool

unshift

It unshift (add) a new value at the beginner of the array. If the array does not exist, then it is created a new array. This command allows to limit the numbers of elements of the array.

Syntax:

unshift($groups, $key, $value, $duration = null, $limit = 0, $limitStrategy = 'popold') : bool

pop

It pops (extract) a value at the end of the array. If the value does not exist then it returns $defaultValue The original array is modified removing the last element of the array.

Syntax:

pop($group, $key, $defaultValue = false, $duration = null) : mixed

shift

It shifts (extract) a value at the beginner of the array. If the value does not exist then it returns $defaultValue The original array is modified removing the last element of the array.

Syntax:

pop($group, $key, $defaultValue = false, $duration = null) : mixed

invalidate a key

function invalidate($group = '', $key = ''): bool

It invalidates a specific key. If the operation fails, then it returns false

invalidate a group

invalidateGroup($group): bool

It invalidates every key(s) inside a group of groups. It also cleans the catalog of the group and sets it to an empty array.

invalidate all

invalidateAll()

It invalidates all cache.

In redis, it deletes the current schema. If not schema, then it deletes all Redis

In memcached and apcu, it deletes all cache

In documentone it deletes the content of the database-folder

setSerializer($serializer)

It sets how the values are serialized. By default, it's PHP.

getSerializer();

Get then how the values are serialized.

Select a database (Redis/PdoOne)

select($dbindex)

It selects a different database. By default, the database is 0.

CLI

This library also has an interactive CLI.In this CLI, you can create the configuration, test it, load and save.

To open it, you must run the next script:

Example REDIS

The configuration will be saved as: c1.config.php.
It is a configuration file that you can include or copy and paste in your code

example

Version

License

Dual license, Commercial and MIT License. Copyright Jorge Castro Castillo


All versions of cacheone with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
eftec/clione Version ^1.32.1
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 eftec/cacheone contains the following files

Loading the files please wait ....