Download the PHP package originphp/cache without Composer

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

Cache

license build coverage

The OriginPHP Cache library Apcu, Memcached and Redis out of the box, you can also use file caching for large objects or time consuming generating content.

Installation

To install this package

In your bootstrap file you will the configuration for cache. The caching library can work with multiple configurations and engines at the same time.

Once the configuration is out the way, using the cache is pretty straightforward. Configure a default Cache store

Caching

Write

To add an item to the cache.

Read

From version 3.x when reading from the cache, if there is no hit then it will return null instead of false as in previous versions.

To read an item from the cache, if it does not find an item it will return null

Exists

To check whether a key exists in the cache

Delete

Items are automatically deleted based upon the duration setting in the configuration, however if you want to delete an item manually then use the delete method.

Clearing the Cache

Enabling and disabling the cache

Sometimes you will need to disable the cache, when you disable we switch the engine to the NullEngine and your program can work as normal.

Working with Multiple Configurations

Whether you are using multiple caching engines, or you multiple configurations for a single cache engine (e.g. short duration and long duration caches), the Cache utility is flexible.

You can get the configured Cache store:

Or you can pass an options array telling the Cache object which configuration to use

Engines

In all these examples,we are only configuring the default configuration, you can set different configuration names instead of default. When you use the caching functions the default configuration is used by default unless you say otherwise.

File Engine

Apcu Engine

Memcached Engine

This is a simple configuration for using Memcached.

If your Memcached server is configured with username and password then

If you are going to use socket then instead of setting host and port, then set the path key with the location of the socket.

You can also make connections persistent by setting the persistent key to true, or a string which will be the persistent id.

Memcached supports server pools, if you are going to use them then set an array using the servers key instead of host and port. The array should be compatible with memcached addservers.

Redis Engine

This is a simple configuration for using Redis.

If your Redis server is configured with a password then

If you are going to use socket then instead of setting host and port, then set the path key with the location of the socket.

You can also make connections persistent by setting the persistent key to true, or a string which will be the persistent id.

Custom Engine

If you want to work with a different backend, it easy to create your own. When configuring cache, instead of passing the engine key, use className and include the full namespace.

Installing Cache Engines

The command line instructions have been tested with Ubuntu 18.x.

Apcu

Apcu is already install in the docker container, however if you need to install this manually.

Memcached

To install Memcached in the Docker container

First add the following to the docker-compose.yml file, this will load the memcached image.

In the Dockerfile add php-memcached to the lines where it installs the php extensions

Then run the build command in docker-compose.

Then set the host to memcached in your cache config.

To install Memcached on a Ubuntu/Debain based server

Redis

To install Redis in the Docker container

First add the following to the docker-compose.yml file, this will load the Redis image.

In the Dockerfile add the following lines to install and enable the Redis PHP extension.

Then run the build command in docker-compose.

Then set the host to redis in your cache config.

To install Redis on a Ubuntu/Debain based server

Testing

To test this first build the docker container

To start the container, and access bash


All versions of cache with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3.0
originphp/configurable Version ^2.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 originphp/cache contains the following files

Loading the files please wait ....