• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

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!

Eventcache

on

  • 3,227 views

Cache invalidation for the lazy coder

Cache invalidation for the lazy coder

Statistics

Views

Total Views
3,227
Views on SlideShare
3,225
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 Eventcache Presentation Transcript

  • Who
  • 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
  • What
  • What Eventcache Cache invalidation for the lazy coder
  • What What I use it for • Caching model data • Caching slow functions • Auto-Purging when an involved model saves / deletes
  • 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
  • Why #1 Why Caching
  • Why Simple
  • Why fastness == pretty awesome Cache adds speed without dropping a sweat
  • Why #2 Why Eventcache (I already use CakePHP/Custom caching)
  • Why Well
  • Why • Caching is easy • Invalidation is hard “There are only 2 hard problems in Computer Science: Cache invalidation, Naming things, Off-by-one errors”
  • Why Eventcache solves 2 of those problems: • Cache invalidation - Sorry, you are on your own with Naming & Off-by-one errors
  • How
  • 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
  • How The Code
  • How Initialize Do a vendor import in your bootstrap Optionally config:
  • How The normal flow ttl didn’t purge nickname. you didn’t purge nickname. User->afterSave did
  • How Tie in with your app Fair enough, Eventcache needs to know about your events ..but that’s all there is to it
  • How Magic function-wrapper Add caching to an existing function with minimal effort -before- just some CPU intensive function
  • 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
  • How More options
  • 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
  • Where
  • 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
  • Questions?
  • Thank you!