Home » Web Services » Services_Amazon » Bug #5672
Enable Caching
Details
| Request #5672 | Enable Caching |
|---|---|
| Submitted | 2005-10-12 19:54 UTC |
| From | seth at pricepages dot org |
| Assigned | ttsuruoka |
| Status | Closed |
| Package | Services_Amazon |
| PHP Version | Irrelevant |
| OS | Mac |
| Roadmaps | (Not assigned) |
Comments
[2005-10-12 19:54 UTC] seth at pricepages dot org
Description:
------------
I'm interested in adding some sort of caching to the
Services_Amazon package that you maintain on PEAR. My
current thinking would be to add these methods:
setCache($cacheType = "file", $cacheOptions = array()){}
setCacheExpire($time){}
And caching all requests in _sendRequest() except any
operation regarding Carts or TransactionLookup.
[2005-10-13 15:23 UTC] ttsuruoka at php dot net
Caching has been added.
AmazonECS4.php (Services_Amazon-0.4.0)
- http://p4life.jp/services_amazon/AmazonECS4.phps
An example:
- http://p4life.jp/services_amazon/cache.phps
Dependency:
PEAR::Cache_Lite
I'm testing now. It works fine for me.
[2005-10-13 16:01 UTC] seth at pricepages dot org
That works, but I was thinking of using Cache and not
Cache_Lite so the DB cache could be used (and shared across
a cluster if needed).
Another advantage of Cache is that the agreement with Amazon
is that if you cache prices for more than an hour you print
a timestamp with the price on the page. Cache allows finer
control over the expire time of data. For example: you don't
cache prices for more than an hour, but you cache product
info lookups for a week. The interface that I posted before
allows the user to determine that.
Also, I would make changes to not cache the SubscriptionId,
AssociateTag, and Version because they shouldn't have any
impact on the result array.
I can make the changes and post what I'm thinking if you are
interested. (I have some other small tweaks, also)
[2005-10-13 17:53 UTC] ttsuruoka at php dot net
>I would make changes to not cache the SubscriptionId,
>AssociateTag, and Version because they shouldn't have any
>impact on the result array.
I think that Version affects a result.
>I can make the changes and post what I'm thinking if
>you are interested. (I have some other small tweaks, also)
Please post your feedback.
Maybe I choose PEAR::Cache for more flexible cache control.
Thanks for your comment.
[2005-10-13 18:37 UTC] seth at pricepages dot org
New file and diff here:
http://pricepages.org/pear/AmazonECS4.zip
[2005-10-14 07:33 UTC] ttsuruoka at php dot net
Caching with PEAR::Cache.
http://p4life.jp/services_amazon/AmazonECS4.phps
http://p4life.jp/services_amazon/cache_example.phps
[2005-10-18 16:49 UTC] ttsuruoka at php dot net
This has been added in version 0.4.0.