-
Notifications
You must be signed in to change notification settings - Fork 81
extensions couchdb
The Railo Server CouchDB Cache Provider Extension allows you to use CouchDB as a key/value cache for your Objects (components), Templates, Queries and Resources (such as files etc).
CouchDB is is a free and open source document-oriented database written in the Erlang programming language. You can find out more information either download or setup your own database at CouchOne
Installing the CouchDB Cache Extension, is straight forward.
1. Go to the server administrator of your railo installation, for example: http://localhost/railo-context/admin/server.cfm
2. Under Extension/Applications you should see that under the "Not Installed" extensions there is "CouchDB Cache ( Beta )"
Image:http://www.getrailo.com/help/wiki/images/extensions_couchdb_1_app_listing.png
3. Select the "CouchDB Cache (Beta)" radio button and click the "Install" Button.
4. In the next screen, you will get (currently) a blank screen with an "Install" button, click this button.
5. You will get a "CouchDBCache is now successfully installed" message.
We need to have a running CouchDB installation to connect to, this section will let guide you through getting CouchDB running
1. Head to the CouchOne website and select products http://www.couch.io/products
2. Download the right version for your Operating System (the screenshots here are for OS X but there should be no difference for each OS)
3. Once downloaded, run CouchDB and you should get the following view:
Image:http://www.getrailo.com/help/wiki/images/extensions_couchdb_2_couchdb.png
4. Create a new database called "railo_cache", this is the database that we are going to use as our cache.
Image:http://www.getrailo.com/help/wiki/images/extensions_couchdb_3_couchdb_newdb.png
1. In the Railo Administrator, Go to Services/Cache and define a new cache connection, by giving it a name "cache_test" and selecting the "CouchDB" type
Image:http://www.getrailo.com/help/wiki/images/extensions_couchdb_4_newconnection.png
2. In the next screen, define the Server Host (default localhost if you are installing the database locally), the Server Port (defaults to 5984) and finally enter the Database name that we created on the CouchDB server: "railo_cache"
Image:http://www.getrailo.com/help/wiki/images/extensions_couchdb_5_connection_details.png
3. You can set it as the default cache for various functions, in this example you can set it as the default Object cache.
4. Finally, click "Submit" to save the connection
5. You should verify the connection works, by ticking the checkbox next to the "cache_test" connection and clicking the verify button
Image:http://www.getrailo.com/help/wiki/images/extensions_couchdb_6_verify.png
6. You are now all set to use the connection!
1. Create a page under your webroot called cachetest.cfm
2. In the cachetest.cfm you add the following code to test the connection:
<h1>Cache Test</h1>
<cfscript>
stItem = {
name: "Elvis",
age: "36"
};
dump(var=stItem, label="Sending to Cache");
cachePut("myElvis",stItem);
dump(var=cacheGet("myElvis"), label="From Cache");
</cfscript>
This code essentially creates a struct called "stItem", we then dump the item, put it in the cache, and retrieve it
3. When you run this code, you will get something that looks like:
Image:http://www.getrailo.com/help/wiki/images/extensions_couchdb_7_example.png
If you get an error along the lines of:
java.lang.NoClassDefFoundError: org/slf4j/spi/LoggerFactoryBinder
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
You should download the slf4j api and slf4j log4j libraries and place them in your lib/ folder of your Railo installation (for example if you are using Apache Tomcat, you should place it in <tomcat></tomcat>/lib folder)
- Getting to know Railo Server
- Railo Server features & specifications
- Getting started with Railo Server
- Installation & configuration
- Railo Server Versions
- Developing with Railo Server
- Deploying Railo Server apps
- Managing Railo Server apps
- Railo Server Extensions
- Useful resources & further reading
- Developing & debugging Railo Server
- FAQs