Download the PHP package rapidwebltd/rw-file-cache without Composer

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

RW File Cache

Build Status Coverage Status StyleCI Packagist

RW File Cache is a PHP File-based Caching Library.

Its syntax is designed to closely resemble the PHP memcache extension.

Installation

You can easily install with composer. Just run composer require rapidwebltd/rw-file-cache.

If you are using Laravel, consider using the Laravel Cache Driver for RW File Cache instead.

Usage

This section will show you how to use RW File Cache. If you have used memcache before, this should be pretty familiar.

Setup & Configuration

Before you can do anything with RW File Cache, you must instantiate it and then, if you wish, set some configuration options.

This code creates a new RW File Cache object called $cache and then configures it to store its cache files in the /tmp/rwFileCacheStorage/ directory.

There are several different configuration variables you can override. The table below describes them.

Option Description Default
cacheDirectory The directory in which you wish the cache files to be stored. We recommend you change this to a site-specific directory and ensure it is outside of the web root. You must include a trailing slash. /tmp/rwFileCacheStorage/
gzipCompression Whether or not to compress cache files using gzip. Unless you are storing very small values in your cache files, we recommend you leave this enabled. true
fileExtension The file extension that will be appended to all your cache files. cache
unixLoadUpperThreshold If your server's load is greater than this value, cache files will be returned regardless of whether they have expired. This can be used to prevent cache files being regenerated when server load is high. If you do not wish to use this feature, set this option to -1. 4.00

Setting a cache item

Putting something in your file cache is easy. You just need to use the set method, as shown below.

The first parameter is the cache key, which uniquely references this cache item.

The second parameter is the cache value - what you wish to store in this cache item. This can be a string, integer, array, object or any type of serializable PHP variable.

The third paramter is the expiry time. It can be specified as a UNIX timestamp or as a number of seconds less than 30 days worth. Cache items will expire and not be retrievable when this time is reached.

Note that if you use dots, dashes, underscores or a few other special characters in your cache key, the created cache files will be put into a directory structure. For example, a cache key of objects.cars.redCar will be stored in objects/cars/redCar.cache. This is useful if you wish to categorise cache files and to prevent too many cache files building up in a single directory.

Getting a cache item

To get a cache item you've previously stored, you need to use the get method. An example of how to do this is shown below.

The only parameter is the cache key you defined when setting the cache item. You can retrieve any cached variable in this way.

Other RW File Cache methods

The setting and retrieval of cache items are the most important parts of RW File Cache. In fact, the set and get methods are probably all you will need.

However, the library provides the following more advanced commands if you need them.


All versions of rw-file-cache with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2.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 rapidwebltd/rw-file-cache contains the following files

Loading the files please wait ....