KnpLabs/Gaufrette — pull request #177 by zeroasterisk (2013-05-07 14:42:17+00:00)
Title: OpenCloud->tryGetObject() local cache array

I have not seen other cache implementations (API re-request defeat) measures implemented in your code. I'm not sure if you have a "policy" on it, or if you have "your own way to implement" this local cache...

But, if you can see fit to implement something like this, it would certainly speed up performance.

When trying to getting details for a single file, I first checked that it exists, then `get()` the basic information, which does a few internal calls... I was getting 4 identical API requests back to Rackspace Files, getting the same information 4 times. After implementing this commit, I only get that API request once.

If you don't implement this approach, I do suggest you implement "some" approach to reduce repeating API requests.

--------------------

I noticed that the API request to get the DataObject was being
called several times on the same basic logic set, on the same `$key`.

Each call resulted in a separate API request, with all the overhead & latency.

So I implemented a very simple local cache for the DataObject, on the Adapter.

The local cache of the DataObject is cleared on write or delete,
otherwise it persists for a single execution (page load/script run) and no more;
so it's not a presistant cache, just to prevent identical API requests on the same run.