This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Do you guys know if anyone has added a MongoDB second level cache provider? How hard is it too implement, is the source code for the Memcached provider available so that I could check that out and try and make a basic MongoDB one?
|
|
|
Also whats the reasoning behind CacheBroker.CachedEntity being private and sealed? How would I go about serializing and deserailzing this guy? [Serializable]
|
|
|
Okay so have worked that bit out and have a very basic MongoDB Cache working (although it doesn't support expiring items yet) Check it out here:
Does Memcache automatically expire items for you? I'm guessing Redis would be also be a good candidate for a Cache as it has support for expiring items automatically.. |
|
|
Or does the broker handle doing the timeouts for you? |
|
|
Nice one! Thanks for posting that! The broker does not handle expiry timeouts -- it just passes the timeout on to the ICache implementation, which is expected to handle expiry itself. This leverages the cache implementations' built-in expiry capability (e.g. Memcached can expire items automatically for you). Since MongoDB, unlike the Web cache or Memcached, doesn't have built-in expiry, you'd have to handle that within your ICache layer. For example, you could timestamp each entry as you add it to MongoDB, and check the timestamp on retrieval. This could lead to inefficiency for large objects because you'd pay the retrieval cost only to throw the item away, so you'd want to do some performance testing on it. I guess you could supplement this with a separate collector process that trawls MongoDB every so often and removes items as they expire, reducing the chance of a stale entity being retrieved. I'm sure that from knowing MongoDB you can come up with better ideas though! |
|