Skip to main content
Known Participant
August 26, 2009
Answered

Need guidance changing to Client Store from Registery

  • August 26, 2009
  • 1 reply
  • 598 views

Hello all,

I decided to pick up my Advanced CF development book I bought 3 years ago when I began creating CF sites.  Something that has caught my attention was managing session states, particularly that the best practice is to use a Client Store in a database.  Previously, I had used the CF server default of Registery to manage my user sessions.  While my site traffic is very low and having the registery store the user data isn't currently a problem, I wanted to take the time to correct this so in future developments, I'm using the Client Store instead.  The book provided step-by-step instructions to set up the client store, which I have done.  What it doesn't give in detail is how my pages should now be coded to take advantage of the client store.

Could anyone provide some references or code examples for how I should be handling user sessions on my site now that the server is set to a client store?  My pages currently use code generated by Dreamweaver, using <cflock>, scope="Sessions" and Session.MM_Username to authenticate to the website pages.  I've heard that once using client store, you no longer need the <cflock> as the database handles this?  I'd really just like to see how to rebuild my pages using correct authenitcation and client variables rather than sticking with this code-generated stuff.  thanks in advance

note:  I do know in application.cfm, I include <cfapplication name="myUsers" sessionmanagement="yes" clientstorage="sessiondb">

That's all the further the book details.

    This topic has been closed for replies.
    Correct answer BKBK

    It should be clientmanagement, not sessionmanagement. I would start with something like

    <cfapplication
        name = "myUsers"
        applicationTimeout = #CreateTimeSpan(1, 0, 0, 0)#
        clientManagement = "yes"
        clientStorage = "sessiondb">

    Then, throughout your application, you simply define the client variables as follows:

    <cfset client.favourite_colour="green">

    There is more in the livedocs on using persistent data .Read everything on client variables within 8 clicks on the forward arrow in the top right-hand corner.

    1 reply

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    August 26, 2009

    It should be clientmanagement, not sessionmanagement. I would start with something like

    <cfapplication
        name = "myUsers"
        applicationTimeout = #CreateTimeSpan(1, 0, 0, 0)#
        clientManagement = "yes"
        clientStorage = "sessiondb">

    Then, throughout your application, you simply define the client variables as follows:

    <cfset client.favourite_colour="green">

    There is more in the livedocs on using persistent data .Read everything on client variables within 8 clicks on the forward arrow in the top right-hand corner.

    Known Participant
    August 27, 2009

    Thanks!  I'm going to dive into this doc right now