<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Word Virus &#187; ColdFusion</title>
	<atom:link href="http://wordvirus.us/tag/coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://wordvirus.us</link>
	<description>The word is now a virus. - William S. Burroughs</description>
	<lastBuildDate>Mon, 06 Feb 2012 11:00:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ColdFusion and Memcache</title>
		<link>http://wordvirus.us/2010/04/coldfusion-and-memcache/</link>
		<comments>http://wordvirus.us/2010/04/coldfusion-and-memcache/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 15:47:52 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://wordvirus.us/?p=2599</guid>
		<description><![CDATA[I&#8217;ve been playing around a lot with integrating ColdFusion and Memcache together over the past week. It&#8217;s a pretty straight forward integration using the Java Memcache Client. Since I couldn&#8217;t find much documentation, outside of the Java docs, I thought I&#8217;d give a few examples of how to get ColdFusion to use a Memcache pool. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around a lot with integrating ColdFusion and Memcache together over the past week.  It&#8217;s a pretty straight forward integration using the <a href="http://github.com/gwhalin/Memcached-Java-Client/downloads" target="_new">Java Memcache Client</a>. Since I couldn&#8217;t find much documentation, outside of the Java docs, I thought I&#8217;d give a few examples of how to get ColdFusion to use a Memcache pool.<br />
<br clear="all" /><br />
First, you&#8217;ll need to install Memcache on your server, or on another server. Memcache by default listens on all interfaces on port 11211.  You can change this, and bind it to localhost.  If you need a cluster of Memcache servers, this client will also handle the pooling feature for you.<br />
<br clear="all" /><br />
Next, place the jar file in the CFX/Java directory and restart ColdFusion. The location of the jar file differs from version to version of CF, and other CFML application engines.  Basically, place the jar file where any other custom jar files go for your version of CF.  Don&#8217;t forget to restart ColdFusion, so it picks up the new jar file.<br />
<br clear="all" /><br />
Now for some example code of how to use the jar file:<br />
<br clear="all" /><br />
You will need to initialize the pool. I suggest doing this in your request manager, or making a method that will check on each memcache call to verify that it is initialized.  I have simple method that gets called in my request manager on each page load.<br />
<br  clear="all" /><br />
<code lang="cfm[lines]"><cffunction name="initMemcachePool" access="private" returntype="void" output="false"><br />
<cfscript><br />
 serverlist = "127.0.0.1:11211";<br />
 serverList = serverlist.split(",");<br />
 pool = createObject("java","com.danga.MemCached.SockIOPool");<br />
 pool = pool.getInstance();<br />
 if(not pool.isInitialized()){<br />
  pool.setServers(serverList);<br />
  pool.initialize();<br />
  poolInit = pool.isInitialized();<br />
 }<br />
</cfscript><br />
</cffunction></code><br />
<br clear="all" /><br />
The next 3 examples are just examples of how to get/set/delete keys.  This is obviously pseudo code, but show how simple it is to use the memcache client.  If you load the memcache java object, and dump it, you will see all the available methods.<br />
<br  clear="all" /><br />
<code lang="cfm[lines]"><cfscript><br />
 var memcached = createObject("java","com.danga.MemCached.MemCachedClient");<br />
 memData = memcached.get(keyName);<br />
</cfscript></p>
<p><cfscript><br />
 var memcached = createObject("java","com.danga.MemCached.MemCachedClient");<br />
 memcached.set(keyName, dataToCache);<br />
</cfscript></p>
<p><cfscript><br />
 memcached = createObject("java","com.danga.MemCached.MemCachedClient");<br />
 memcached.delete("keyName");//delete a specific key<br />
 memcached.flushAll();//delete all keys<br />
</cfscript></code></p>
]]></content:encoded>
			<wfw:commentRss>http://wordvirus.us/2010/04/coldfusion-and-memcache/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Better last key inserted function for mySQL in ColdFusion8</title>
		<link>http://wordvirus.us/2008/06/i-guess-i-should-read-the-documentation-for-coldfusion-8-more-often-%c2%a0turns-out-there-is-a-new-feature-when-doing-database-inserts-%c2%a0in-the-cfquery-tag-add-the-parameter-result8221/</link>
		<comments>http://wordvirus.us/2008/06/i-guess-i-should-read-the-documentation-for-coldfusion-8-more-often-%c2%a0turns-out-there-is-a-new-feature-when-doing-database-inserts-%c2%a0in-the-cfquery-tag-add-the-parameter-result8221/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 01:29:00 +0000</pubDate>
		<dc:creator>gabriel</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[mySQL]]></category>

		<guid isPermaLink="false">http://tumblr.themadness.org/post/40012728</guid>
		<description><![CDATA[I guess I should read the documentation for ColdFusion 8 more often.  Turns out, there is a new feature when doing database inserts.  In the CFQUERY tag, add the parameter result=&#8221;somename&#8221;.  You can now reference the data inserted into the query, as well as, a really cool new feature, the last inserted key.  Each database [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://14.media.tumblr.com/8u59InXbmapw9225ZNW3wazh_500.png" alt=""/><br/><br/>
<p>I guess I should read the documentation for ColdFusion 8 more often.  Turns out, there is a new feature when doing database inserts.  In the CFQUERY tag, add the parameter result=&#8221;somename&#8221;.  You can now reference the data inserted into the query, as well as, a really cool new feature, the last inserted key.  Each database type has a different name for this.  MySQL calls it GENERATED_KEY.  You no longer need to do a second query to get back the last_insert_id().</p>
<p><code> </code></p>
<p>&lt;cfquery datasource=&#8221;#application.dsn#&#8221; result=&#8221;insertPhoto&#8221;&gt;</p>
<p>INSERT INTO kidPhotos</p>
<p>(subject, body, dateOf, siteType)</p>
<p>VALUES</p>
<p>(&lt;cfqueryparam value=&#8221;#subject#&#8221; cfsqltype=&#8221;cf_sql_varchar&#8221;&gt;,</p>
<p>&lt;cfqueryparam value=&#8221;#body#&#8221; cfsqltype=&#8221;cf_sql_varchar&#8221;&gt;,</p>
<p>&#8216;#dateformat(date, &#8220;yyyy-mm-dd&#8221;)#&#8217;,</p>
<p>&#8216;ap&#8217;)</p>
<p>&lt;/cfquery&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://wordvirus.us/2008/06/i-guess-i-should-read-the-documentation-for-coldfusion-8-more-often-%c2%a0turns-out-there-is-a-new-feature-when-doing-database-inserts-%c2%a0in-the-cfquery-tag-add-the-parameter-result8221/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.457 seconds -->

