Skip to content

Commit c8a225b

Browse files
authored
Merge pull request #89 from eliotsykes/recommend-rake-trim
Recommend running `rake db:sessions:trim` daily
2 parents 5c9acf1 + a7df0f1 commit c8a225b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ gem 'activerecord-session_store'
1717
Run the migration generator:
1818

1919
rails generate active_record:session_migration
20-
20+
2121
Run the migration:
2222

2323
rake db:migrate
@@ -28,6 +28,13 @@ Then, set your session store in `config/initializers/session_store.rb`:
2828
Rails.application.config.session_store :active_record_store, :key => '_my_app_session'
2929
```
3030

31+
To avoid your sessions table expanding without limit as it will store expired and
32+
potentially sensitive session data, it is strongly recommended in production
33+
environments to schedule the `db:sessions:trim` rake task to run daily.
34+
Running `bin/rake db:sessions:trim` will delete all sessions that have not
35+
been updated in the last 30 days. The 30 days cutoff can be changed using the
36+
`SESSION_DAYS_TRIM_THRESHOLD` environment variable.
37+
3138
Configuration
3239
--------------
3340

0 commit comments

Comments
 (0)