Skip to content
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

Allow to cache any objects and arrays, not only strings #17

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

stanishevsky
Copy link

I think this class can be much more useful if we can cache any kinds of objects. Just let's store serialized variable, and unserialize it upon cache access.

@rubenflush
Copy link

Also, there needs to be a way to remove a file from cache.

Date: Fri, 28 Nov 2014 11:22:49 -0800
From: [email protected]
To: [email protected]
Subject: [Cache] Allow to cache any objects and arrays, not only strings (#17)

I think this class can be much more useful if we can cache any kinds of objects. Just let's store serialized variable, and unserialize it upon cache access.

You can merge this Pull Request by running
git pull https://github.com/stanishevsky/Cache master
Or view, comment on, or merge it at:

#17

Commit Summary

Allow to cache any objects and arrays, not only strings

File Changes

M
Cache.php
(8)

Patch Links:

https://github.com/Gregwar/Cache/pull/17.patch
https://github.com/Gregwar/Cache/pull/17.diff


Reply to this email directly or view it on GitHub.

                  =

@Gregwar
Copy link
Owner

Gregwar commented Nov 29, 2014

Hello

First, you are doing two things simultaneously, serializing and rehashing filenames, moreover you breaks the unit tests

Regarding serializing/unserializing, I don't think this should be done this way. This system should be useable for caching images or generated pages. Always serializing data would be both useless and overhead for many use cases.

You can add helpers that would have other names like getObject to achieve this

Concerning file hashing, I don't get the point of making it in the cache system, calling sha1 or another logic that hashes before asking the cache is a matter of seconds

thanks for your suggestions

@garygreen
Copy link
Contributor

-1 to this. It should be down to the developer to serialize (in the format they want) and not up to the cacher to make these decisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants