[cachebox] - Couchbase Provider and Lookup() method

Another quick couchbase question. Would I be correct in assuming that using lookup() to determine whether to pull fresh data and do a set() would not be a good idea to use with the couchbase provider/server? I’ve not found it to be particularly reliable anyway but I would guess that with couchbase it would be even less so. I’m planning to just implement the getOrSet which wasn’t included in the couchbase provider which uses the far more reliable method of attempting a get() and if nothing is returned, doing the set. That’s typically what I do in code anyway so I liked having that method available to shortcut it.

Mary Jo

Yes you are right Mary Jo. Lookups are for that instant in time. After that line things could change

Luis Majano
Ortus Solutions, Corp
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

It might be worth mentioning that and/or changing it on the cachebox wiki, as it’s used as the sample method for checking cache items and setting them. I had to go back and get rid of those even with the normal cachebox provider due to that being a problem.

FYI, just added a pull request for the getAndSet on the couchbase provider code.

Mary Jo

Like Luis mentioned, it is possible that an item could be removed from cache between when you checked for its existence and when you actually retrieved it in a second operation.

That said, can you expound on the unreliability you were seeing?



ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Exactly that behavior. Running lookup() to see if a cache item exists and getting true but then it not being there later in the request when running the get().