prismicio-community/php-kit

CacheInterface methods' documentation don't specify return value

Closed this issue · 5 comments

I notice that DefaultCache returns the return value of the various APC functions used when running set, delete and clear but that the value to be returned is not documented in the interface. I'm implementing the interface and therefore don't know if I'll be complying by returning nothing -- perhaps some internal Prismic method expects a return value from these methods.

While I'm at it, I notice that the get method defines its return value as a stdClass of "the value of the entry". Should it always be a stdClass? Where are the docs on what to return if it isn't in the cache at all? (I note that CacheTest expects it to return false if nothing is found. This should certainly be documented -- I would have presumed null.)

Hi,

Yes you're right, it should be documented. We'll work on it.

In 179a833 the return value of get is now more clearly specified as null on failure, but the NoCache and DefaultCache don't comply, instead passing false on failure. http://php.net/manual/en/function.apc-fetch.php The associated test also still expects false on failure.

This ticket was also asking for specifications on what if anything the other methods should return.

@erwan, this is still an issue. This shouldn't be closed.

Additionally, the CacheTest hasn't been updated to reflect the new documentation. I'll provide pull requests.