Download the PHP package davidmpeace/squirrel without Composer

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

Squirrel

Squirrel is an Eloquent cacheing solution that handles the complexities of 'remembers' and 'forgets' for you. This package is intended to be used with Laravel. Squirrel automatically caches and retrieves models when querying records using Eloquent ORM. When Squirrel is used, you can expect to see orders of magnitude fewer queries to your database, with the confidence you will never be retrieving stale data from Cache.

License

Squirrel is open-sourced software licensed under the MIT license

Installation

To get started with Squirrel, add to your composer.json file as a dependency:

composer require davidmpeace/squirrel

Basic Usage

To use the Squirrel library, you simply need to use the Squirrel trait for any model you want to implement cacheing for. Typically, you would want to implement the trait in your super-class so that all your sub-classes will automatically inherit the functionality.

That's it! You will now automatically inherit all the magic of Squirrel.

Default Behavior

Without any customization, Squirrel behaves in the following default manner:

1) Each model will be cached using the key returned from the $model->getKeyName() method, as defined in the base Eloquent Model class. 2) The Cache is "active" for all models that use the Squirrel trait. 3) Each model is cached for 24 hours before expiring.

Configuration

Sometimes you'll need custom configuration on a per-model basis. Here are some examples of methods you can implement to override default behavior.

Global Configuration & Methods

Use the following global configuration methods to update settings for all models that implement Squirrel cache.

Squirrel Model Instance Methods

These methods are available to any Object using the Squirrel Trait

Queries Supported

Squirrel is meant to support multiple unique keys, as well as compound unique keys, so any query that is attempting to bring back a single row based on a unique key will work. However, you may also perform an "In" query, as long as that's the only part of the query. See below:

Under the Hood

The way Squirrel works is by extending the default \Illuminate\Database\Query\Builder Class, which is responsible for executing queries for your models.

By default, Models inherit a method called newBaseQueryBuilder() which is responsible for returning the Builder object. We overload this method so we can return the SquirrelQueryBuilder object instead.

The SquirrelQueryBuilder->get() method does the actual querying. However, before we query the data, we first check to see if our model is cached via any unique keys, if so, we return it, otherwise, we do the query. Finally, after the query is executed, we save the retrieved data in cache so it doesn't get hit again until the data expires.

Cache keys are stored in the following format:

SquirrelCache::$cacheKeyPrefix . "::" . get_class($model) . "::" . serialize(uniquekey);

Example for User model where id=1:

Squirrel::App\\User::a:1:{s:2:"id";s:1:"1";}

Example for User model where account_id=27 and [email protected]:

Squirrel::App\\User::a:2:{s:10:"account_id";s:2:"27";s:5:"email";s:11:"[email protected]";}


All versions of squirrel with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.*|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 davidmpeace/squirrel contains the following files

Loading the files please wait ....