Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Like this? Share it with your network

Share

Eventcache

on

  • 3,329 views

Cache invalidation for the lazy coder

Cache invalidation for the lazy coder

Statistics

Views

Total Views
3,329
Views on SlideShare
3,327
Embed Views
2

Actions

Likes
2
Downloads
11
Comments
0

2 Embeds 2

http://twittertim.es 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Eventcache Presentation Transcript

  • 1. Who
  • 2. Who Kevin van Zonneveld t: @kvz e: kvz@php.net • cake: Learned from @felixge while working on http://phpjs.org Now building http://true.nl backend & admin in it • like: Reusable code & to Automate everything • startup: http://transloadit.com
  • 3. What
  • 4. What Eventcache Cache invalidation for the lazy coder
  • 5. What What I use it for • Caching model data • Caching slow functions • Auto-Purging when an involved model saves / deletes
  • 6. What Features • Invalidation Obviously • Doesn’t care about your PHP Framework I use CakePHP, but it’s not tied to that • “Magic function-wrapper” Allows for easy integration in your app.. I’ll show you in a minute! • Easy access EventCache::read(); // like Cake’s Cache::read(); • Speed Eventcache additionally uses inside-process memory This way the cache backend is only hit once per key per process • Supports multiple backends Apc, File, Memcache, Redis
  • 7. Why #1 Why Caching
  • 8. Why Simple
  • 9. Why fastness == pretty awesome Cache adds speed without dropping a sweat
  • 10. Why #2 Why Eventcache (I already use CakePHP/Custom caching)
  • 11. Why Well
  • 12. Why • Caching is easy • Invalidation is hard “There are only 2 hard problems in Computer Science: Cache invalidation, Naming things, Off-by-one errors”
  • 13. Why Eventcache solves 2 of those problems: • Cache invalidation - Sorry, you are on your own with Naming & Off-by-one errors
  • 14. How
  • 15. How When you store a key • Also register what events will trigger it’s removal • Optionally specify other conditions that have to be met e.g.: parent model’s timestamp, customer_id • Eventcache takes care of invalidation
  • 16. How The Code
  • 17. How Initialize Do a vendor import in your bootstrap Optionally config:
  • 18. How The normal flow ttl didn’t purge nickname. you didn’t purge nickname. User->afterSave did
  • 19. How Tie in with your app Fair enough, Eventcache needs to know about your events ..but that’s all there is to it
  • 20. How Magic function-wrapper Add caching to an existing function with minimal effort -before- just some CPU intensive function
  • 21. How Magic function-wrapper Add caching to an existing function with minimal effort -after- By adding 4 lines of code, the function is now cached
  • 22. How More options
  • 23. How What’s needed • More fine-grained events You could do this yourself, but it would be nice if Eventcache supported events with arguments so you never purge more than needed • Adapters Currently, the APC adapter has some issues • Your tender, love & care Exposing to more programmers & environments to will surface bugs & feature requests to make it perfect
  • 24. Where
  • 25. Where Here: • Fork http://github.com/kvz/eventcache • Follow http://twitter.com/kvz • Subscribe http://kevin.vanzonneveld.net • Mail kvz@php.net • Check http://transloadit.com
  • 26. Questions?
  • 27. Thank you!