cfmemcached v1.2 released today - download yours now

I tested and uploaded a new release for cfmemcached today. This update includes a new java library from each branch. Greg and Dustin updated their code, so i'm passing it along to you for your caching pleasure.

This new release includes a number of upgrades to the coldfusion piece as well.

cfmemcachedNew -

  • included the updated java library from dustin that has some performance fixes
  • Update coldfusion library to have a configurable timeout. Base timeout can be set as well as a time out per request, in case you want to extend it to wait for a long running cache or a bulk operation that needs to wait on several memcached responses
  • more cftries and catches - trying to make the application fail gracefully

cfmemcachedOld -

  • included the updated java library from greg that has some performance fixes
  • added a lot more cftries and catches to make it fail better, ie fail gracefully so that it doesn't impact your overall application.

as always, cfmemcached is located at cfmemcached.riaforge.org -- Coldfusion memcached

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Patrick's Gravatar Hi Jon,
first of all thank for your great work on this. We are using memcached
1.1 here with about 2m cache hits / day and it works great.

While trying out the 1.2 i come across this strange behavior.
When i run the memcachedtest and i leave the value for simpleval at
simpleval43466665532 it will not set this value and the set2.get() does return a NO.
For all following variables (set3, set4 etc.) the setX.get() will also return a NO
even though they are being set.
Now the strangest thing. If i cut 2 numbers at the end to make it
simpleval434666655
it will work just fine.

Can you please have a look into this. The queries and arrays are also setting fine, just this one value.
# Posted By Patrick | 3/7/08 3:22 AM
Patrick's Gravatar Figured this out now. I was using an old memcached version that for some reason kept losing entries.
I used the Hermes Vmware Appliance but that is too old :(
Installed a fresh 1.2.5 memcached and now it works fine.
# Posted By Patrick | 3/12/08 12:18 AM
Jon Hirschi's Gravatar I'm glad to hear that it's working well for you now. I'll update the docs to indicate that version 1.2 of the memcached server is required.
# Posted By Jon Hirschi | 3/12/08 9:14 AM
Rahul's Gravatar Was evaluating cfmemcached, thought to point this out. In init() of _base.cfc I think you should have :
   setDefaultTimeoutUnit();
   setDefaultRequestTimeout();
instead of :
variables.defaultTimeoutUnit = setDefaultTimeoutUnit();
variables.defaultRequestTimeout = setDefaultRequestTimeout();
as using the assignment will always set true, true than the actual values for both timeOuts
# Posted By Rahul | 5/7/08 4:19 AM
Paul's Gravatar Minor point, but the memchacedtest.cfm page does not have the correct capitalization on MemcachedFactory
This:
<cfset variables.memcachedFactory = createObject("component","memcachedFactory").init("127.0.0.1:11211")>
Should be:
<cfset variables.memcachedFactory = createObject("component","MemcachedFactory").init("127.0.0.1:11211")>
# Posted By Paul | 12/15/08 11:19 AM
Gunnar's Gravatar just testing the cfc, i ran into a 500 error with a large query with 100000 records and 5 numeric columns

any idea how to get rid of it?

Thanks,

Gunnar
java.lang.StackOverflowError
   at java.lang.ref.ReferenceQueue.poll(ReferenceQueue.java:82)
   at java.io.ObjectStreamClass.processQueue(ObjectStreamClass.java:2234)
   at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:266)
   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
   at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
   at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
   at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
# Posted By Gunnar | 6/16/09 10:51 AM
Mike's Gravatar Hi - we've been using cfmemcached for some time now to store and retrieve data strictly through coldfusion. However, we're starting to integrate a java application into the mix and want to have the java app (using a java memcached client) store data on our memcached server and have it be retrieved through the coldfusion memcached client.

We've run in to issues where data stored through the java client isn't retrievable from the coldfusion client - the coldfusion client can see the key (keyExists works) but retrieving the key through the get() methods returns nothing.

We're using the same memcached java library under the hood - so could it be that its not casting the data properly? We're also storing the java objects as strings when we put them in.

Any insight would be great!
# Posted By Mike | 7/19/09 10:15 AM
Jon Hirschi's Gravatar Michael,

Glad to hear that you are getting some good use out of the library. According to your description, it sounds like what might be happening is that there could be a deserialize issue that is trapping the error and not returning what you would expect. I've used a lot of try/catches to avoid errors. In general, I figured that it would be better to get back nothing and move on than throw an error... Have you tried the retrieval by removing the try catches?

The other suggestion that I could make is that it would probably be beneficial to go get the updated java library. Dustin, the guy who wrote the underlying java library has put in a lot of work to fix the underlying library and has made it much better. I haven't updated the cfmemcached distribution yet. In tests that I've done, it looks like you can just drop in the new jar and not need to make any changes... should just work.

You can find the newest library here:

   http://code.google.com/p/spymemcached/

if any of those don't work, the other thing you'd want to take a look at is to make sure that you are using the same hashing scheme for both the java version and the coldfusion version.

In the cf library I've tried to make it so that simple variables get stores as direct simple variables, so as long as you are setting a straight up java string, coldfusion should be able to use it.

Hope that helps!
# Posted By Jon Hirschi | 7/21/09 11:55 PM
Chris's Gravatar Does the "cfmemcachedNew" not have the keyExists() function? What is the best way to test for key existence without this?
# Posted By Chris | 10/14/09 11:28 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.7.