sasa1977 / con_cache

ets based key/value cache with row level isolated writes and ttl support
MIT License
910 stars 71 forks source link

add ConCache.select #15

Closed rixmann closed 8 years ago

rixmann commented 8 years ago
sasa1977 commented 8 years ago

Thank you for this PR.

However, I'm currently not inclined to merge it for a couple of reasons.

First, there's a possible confusion with heuristics of touching. Imagine that values are themselves two element tuples, and match patter returns only values. This code would then wrongfully conclude that the first element is a key and perform needless touching. Even worse, if these fake keys correspond to some real keys, we might even touch some rows which are not supposed to be touched. Thus I don't think we should touch here at all, because we can't provide clear semantics. This in turn means that the select operation becomes an extremely simple wrapper around :ets.select, and I don't think it's worth it.

It's not the goal of ConCache to wrap ETS completely. In fact, a while ago I have removed some needless wrappers. Using ETS is pretty simple through ConCache.ets/1, and touching can be done with ConCache.touch/2. Combining those two should be simple enough on the client side, so I don't think we need a wrapper for that.

rixmann commented 8 years ago

you are right, i will wrap this myself thank you