Download the PHP package simplesoftwareio/simple-cache without Composer

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

Simple Cache

Build Status Latest Stable Version Latest Unstable Version License Total Downloads

Try our dead simple, free file transfer service keep.sh

Configuration

Composer

First, add the Simple Cache package to your require in your composer.json file:

"require": {
    "simplesoftwareio/simple-cache": "~1"
}

Next, run the composer update command.

Usage

The cacheable trait may be used by adding the trait to the Eloquent model of your choice.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use SimpleSoftwareIO\Cache\Cacheable;

class User extends Model
{
    use Cacheable;
}

Yes, it really is that simple to use. The settings will use the default Cache store set up in your Laravel application. Further, models will be cached for 30 minutes by default.

Properties

cacheLength

You may adjust the default cache length by modifying the cacheLength property on the model.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use SimpleSoftwareIO\Cache\Cacheable;

class User extends Model
{
    use Cacheable;
    protected $cacheLength = 60; //Will cache for 60 minutes
}

cacheStore

The configured cache store may also be adjusted by modifying the cacheStore property. The cache store will need to be set up in your application's config/cache.php configuration file.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use SimpleSoftwareIO\Cache\Cacheable;

class User extends Model
{
    use Cacheable;
    protected $cacheStore = 'redis'; //Will use the configured `redis` store set up in your `config/cache.php` file.
}

cacheBusting

Cache busting will automatically invalid the cache when an insert/update/delete command is ran by your models. You can enable this feature by setting the cacheBusting property to true on your Eloquent model. By default this feature is disabled.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use SimpleSoftwareIO\Cache\Cacheable;

class User extends Model
{
    use Cacheable;
    protected $cacheBusting = true;

}

Be careful! Eloquent Model's with a high amount of insert/update/delete traffic should not use the cache busting feature. The large amount of changes will invalid the model too often and cause the cache to be useless. It is better to set a lower cache length to invalid the results frequently if up to date data is required.

Methods

flush()

The flush method will flush the cache for a model.

(new User)->flush()  //Cache is flushed for the `User` model.

isBusting()

isBusting will return the current status of the cacheBusting property.

if((new User)->isBusting()) {
    // Is cache busting
}

remember($length)

remember will set the length of time in minutes to remember an Eloquent query.

User::remember(45)->where('id', 4')->get();

rememberForever()

rememberForever will remember a query forever. Well, technically 10 years but lets pretend it is forever eh?

User::rememberForever()->where('id', 4')->get();

dontRemember()

And lastly, dontRemember will not cache a query result.

User::dontRemember(0)->where('id', 4')->get();

All versions of simple-cache with dependencies

PHP Build Version
Package Version
Requires illuminate/database Version ~5
illuminate/cache Version ~5
illuminate/support Version ~5
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 simplesoftwareio/simple-cache contains the following files

Loading the files please wait ....