vivekn / redis-simple-cache

Simple redis based cache for storing results of python function calls, json encoded strings or html.
Other
122 stars 69 forks source link

Move cache key creation method to SimpleCache #35

Closed floer32 closed 9 years ago

floer32 commented 9 years ago

so that this method can be overwritten!

vivekn commented 9 years ago

We already have namespaces, is there a use case where namespaces won't work and this will?

floer32 commented 9 years ago

It doesn't impact the code much to make the change, and namespaces are a redis feature not a library feature, right? The user shouldn't be forced to use a redis feature for this purpose, particularly when the premise of the library is to KISS. For some clients, this might be the clearest way to do it.

Please also notice https://github.com/hangtwenty/redis-simple-cache/commit/37b4f9446c6c3b82671bdcc7055bf75a41c9f133 , I want to make sure that gets in.

vivekn commented 9 years ago

Redis allows namespacing through virtual database numbers. Each database number corresponds to a flat global namespace. The namespace parameter in SimpleCache is a prefix to keys in the database to prevent collisions with other keys in that database. There is already an option to tell SimpleCache which database to use, or what prefix to use, in case the user wants something different from the default values.

Your other commit looks fine.

floer32 commented 9 years ago

OK, thank you for taking the time to explain!