Railo Extension - Ram Resource Info

Gert just tweeted about the "Ram Resource Info" being available on the preview site ( http://preview.getrailo.org/ExtensionProvider.cfc ). I thought I'd take a moment to show you how to install and use it.

Step 1.

Log into your local web context ( example: http://{your host}/railo-context/admin/web.cfm ) and underneath Extensions click on Providers. Type in "http://preview.getrailo.org/ExtensionProvider.cfc" into the input field and click save. Screenshot

Step 2. (Optional)

You can verify that this is working by clicking on the checkbox next to the provider and clicking the Verify button. Screenshot

Step 3.

Now that is done, go ahead and click on Extension-> Applications. Select the "Ram Resource Info" radio button and click Install. Screenshot - Once installed, you'll see a success message.

Using Ram Resource Info

If you did everything above correctly, you should see a new item in your navigation underneath Plugin called Ram Resource Info. Click on it and you'll see the application. Screenshot

At the moment, it doesn't look like it's doing much, but if we write up some CFML to populate the VFS (Virtual File System) - ram:///, we can see it in action.

Sample CFML Code to populate the VFS


<cfloop index="file" from="1" to="10">
<cfset fileWrite('ram:///test#file#.txt','blah')>
</cfloop>
<cfdirectory action="create" directory="ram:///stuff">
<cfloop index="file" from="1" to="10">
<cfset fileWrite('ram:///stuff/test#file#.txt','blah')>
</cfloop>

So, this is basically creating test1.txt -> test10.txt with the content of 'blah'. It's also creating a sub-directory called 'stuff' and creating 10 more text files inside of it. Go ahead and run the code (btw, there will be no output).

After running the code, go back and take a look at the Ram Resource Info page now and it should resemble this screenshot. As you can see, you can view all the files and folders in the ramdrive. You can download the files. You can navigate into the sub-directory called 'stuff' and see what files are available. You can navigate back up to the main ram drive space and then you can also use the check boxes available to delete particular files.

Hope this is useful and if there are any issues, please let us know!

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Adrian Lynch's Gravatar Is there a reason this works in web but not server admin?
# Posted By Adrian Lynch | 12.11.09 12:41
Todd Rafferty's Gravatar I actually had to research this, but the answer is yes there is a good reason.

I wasn't aware of this until just this morning, but ram:/// is specific to each web context. Case in point, my screenshots were showing everything I did on http://testbed/ - I went over to my http://localhost/ and installed the application and my ram:/// is empty.
# Posted By Todd Rafferty | 12.11.09 14:52
Tony Garcia's Gravatar I haven't really played with the VFS features of ColdFusion 9 (or Railo, for that matter). But I heard the guys on the CFHour podcast say that VFS in CF9 should probably be disabled on shared hosts because because the RAM memory can be accessed accross the entire instance. (I don't have any first-hand experience with this, it's just what I heard the guys say).
If that's true, I think it's actually cool that Railo implemented VFS so that each web context gets its own RAM space.
# Posted By Tony Garcia | 12.11.09 15:14
Todd Rafferty's Gravatar @All: Gert provided information for how you can get started on a "global" ram://
----
Another thing. At the moment the ram resource is defined in each web context’s railo-web.xml.cfm file. The definition looks like this:

<resource-provider
scheme="ram"
class="railo.commons.io.res.type.ram.RamResourceProvider"
arguments="case-sensitive:true;lock-timeout:1000;"/>

If you now copy the above definition to the railo-server.xml file like follows:

<resource-provider
scheme="gram" <<< this scheme just says something like global RAM
class="railo.commons.io.res.type.ram.RamResourceProvider"
arguments="case-sensitive:true;lock-timeout:1000;"/>

and restart the server, you could actually use a global ram resource in order to share files across the server. You can of course use any other scheme for it. Then after that you can use it like this:

<cffile action=”copy” source=”c:\temp.txt” destination=”gram:///test.txt”>
# Posted By Todd Rafferty | 12.11.09 16:43
Todd Rafferty's Gravatar Please note in the 2nd <resource-provider> he changed the name from "RAM" to "GRAM".
# Posted By Todd Rafferty | 12.11.09 16:46
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner