Slide 1

Slide 1 text

Testing Cache with time travel Lucas Neves Martins @nevemartins @resdigitais

Slide 2

Slide 2 text

Rails Caching Rails ActiveSupport Request Dalli MemCached https://github.com/mperham/dalli

Slide 3

Slide 3 text

Performance? 15.000ms Without Cache With Cache 00.050ms MemCached 00.005ms

Slide 4

Slide 4 text

Setup production.rb

Slide 5

Slide 5 text

Usage dashboard.rb

Slide 6

Slide 6 text

Testing Cache should be created; Cache should be used; Cache should expire; Cache should be created again; Time Travel?

Slide 7

Slide 7 text

Delorean! https://github.com/bebanjo/delorean

Slide 8

Slide 8 text

Preparing dashboard_spec.rb

Slide 9

Slide 9 text

Test #01 Test if we are hitting memcached dashboard_spec.rb

Slide 10

Slide 10 text

Test #02 Test that we are NOT hitting memcached dashboard_spec.rb

Slide 11

Slide 11 text

Cleaning Up dashboard_spec.rb Back to the Future!

Slide 12

Slide 12 text

Other Caching Strategies

Slide 13

Slide 13 text

Fragment Caching Russian Dolls Page Cache Action Cache Fragment Cache Fragment Cache Web Server Rack Rails

Slide 14

Slide 14 text

Fragment Caching

Slide 15

Slide 15 text

Alternatives Delorean => Timecop Memcached => Redis http://37signals.com/svn/posts/3113-how-key-based-cache- expiration-works Caching:

Slide 16

Slide 16 text

Q & A http://resultadosdigitais.com.br/trabalhe-conosco Yay!