code-dot-org/code-dot-org — pull request #832 by laurelfan (2014-12-11 06:09:57+00:00)
Title: use redis as an L2 cache for the Script.script_cache stuff

1. after seeding, daemon loads the script cache and puts it in redis
2. when any frontend starts up, the first attempt to access the script cache checks redis for a copy and loads it from there (if it doesn't have redis configured or it's not in redis, it will fall back to getting it from the db)

daemon is the only one who puts the script cache in redis and does so only after seeding, so this introduces no new versioning/concurrency etc issues (i.e. we have the same ones that we already have because daemon puts things in the database before the application code is sent to the frontends).

See:

````
ubuntu@production-console:~/production/dashboard$ rake seed:script_cache_to_redis
ubuntu@production-console:~/production/dashboard$ dashboard-console
Loading production environment (Rails 4.0.3)
irb(main):001:0> Rails.logger.level = 0
=> 0
irb(main):002:0> Script.get_from_cache('frozen').script_levels[3].level.game.name
=> "Custom"
````

(Rails.logger.level sets the log level to spew everything, like it does in development, so I'd see any DB queries)