-
Notifications
You must be signed in to change notification settings - Fork 10
Caching #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Caching #4
Conversation
Hi Ben -- Thanks for this. First, I think you should take a look at the way the adapter pattern is used to abstract the http client library used as well as how globals are referenced. I'd like for the cache mechanism to use the adapter pattern. This way, it'd be trivial for someone to write their own adapter if they happen to use something other than the native memcache or APC or whatever. Check these out, for example: https://github.com/benabus/cheddargetter-client-php/blob/master/Http/AdapterInterface.php https://github.com/benabus/cheddargetter-client-php/blob/master/Http/NativeAdapter.php So, a cache interface would have method like Also, I'm afraid I jumped the gun a little. Since you worked on this I've implemented a CG cache on the server side. The client side should leverage this just like a GUI browser would, for example. CG is now honoring the If-Modified-Since and If-None-Match request headers for a few request types. The advantage here is that the client can make the request as usual, receive the cache headers, cache if instructed then subsequent requests receive a 304. It's all a bit complicated. If you'd like to continue working on this, let me know and we can sit down and get into some more detail. |
I must not understand the adapter pattern as well as I thought. Let me Ben Serrette On Tue, Aug 28, 2012 at 11:38 AM, Marc Guyer notifications@github.comwrote:
|
Okay, I've essentially translated it to use more of an adapter pattern, based on the other adapters/interfaces that I saw (Http, Client). I'm hoping this is more of what you were looking for. I haven't added in anything related to your sever-side caching. Let me know if you think these updates are any better and if you would still like my help. It's been a learning experience for me. |
Added caching. Caches getCustomer and getPlans. Uses Memcache, APC or Sessions depending on which is available.