06.10.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Redis 438<br />

The default server configuration should suffice for development. However, you are free to modify<br />

this array based on your environment. Simply give each Redis server a name, and specify the host<br />

and port used by the server.<br />

The cluster option will tell the Laravel Redis client to perform client-side sharding across your<br />

Redis nodes, allowing you to pool nodes and create a large amount of available RAM. However,<br />

note that client-side sharding does not handle failover; therefore, is primarily suited for cached data<br />

that is available from another primary data store.<br />

Additionally, you may define an options array value in your Redis connection definition, allowing<br />

you to specify a set of Predis client options²⁰⁹.<br />

If your Redis server requires authentication, you may supply a password by adding a password<br />

configuration item to your Redis server configuration array.<br />

Note: If you have the Redis PHP extension installed via PECL, you will need to rename<br />

the alias for Redis in your config/app.php file.<br />

Basic Usage<br />

You may interact with Redis by calling various methods on the Redis facade. The Redis facade<br />

supports dynamic methods, meaning you may call any Redis command²¹⁰ on the facade and the<br />

command will be passed directly to Redis. In this example, we will call the GET command on Redis<br />

by calling the get method on the Redis facade:<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!