Skip to content

Commit

Permalink
Update README with info about signed cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Scott committed Sep 17, 2019
1 parent 6c3af02 commit 05aabc8
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,39 @@ gem 'redis-actionpack'

## Usage

If you are using redis-store with Rails, consider using the [redis-rails gem](https://github.com/redis-store/redis-rails) instead. For standalone usage:
If you are using redis-store with Rails, head on over to the
[redis-rails README](https://github.com/redis-store/redis-rails#session-storage) to
learn how to integrate this gem into your Rails application.

For standalone usage:

```ruby
ActionController::Base.cache_store = ActionDispatch::Session::RedisStore.new
ActionController::Base.session_store = :redis_store,
servers: %w(redis://localhost:6379/0/session),
expire_after: 90.minutes,
key: '_my_application_session',
threadsafe: false,
signed: true,
secure: true
```

A brief run-down of these options...

- **servers** is an Array of Redis server URLs that we will attempt to find
data from.
- **expire_after** is the default TTL of session keys. This is also set
as the expiry time of any cookies generated by the session store.
- **key** is the name of the cookie on the client side
- **threadsafe** is for applications that run on multiple instances. Set
this to `false` if you want to disable the global mutex lock on
session data. It's `true` by default, meaning the mutex will be
enabled.
- **signed** uses signed/encrypted cookies to store the local session on
a client machine, preventing a malicious user from tampering with its
contents.
- **secure** ensures HTTP cookies are transferred from server to client
on a secure (HTTPS) connection

## Running tests

```shell
Expand All @@ -37,8 +64,8 @@ If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bun

## Status

[![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack)
[![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.svg?branch=master)](http://travis-ci.org/redis-store/redis-actionpack?branch=master)
[![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack)
[![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.svg?branch=master)](http://travis-ci.org/redis-store/redis-actionpack?branch=master)
[![Code Climate](https://codeclimate.com/github/redis-store/redis-actionpack.svg)](https://codeclimate.com/github/redis-store/redis-actionpack)

## Copyright
Expand Down

0 comments on commit 05aabc8

Please sign in to comment.