Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Silverstripe CMS on a clustered server environment


Reply

5 Posts   301 Views

Avatar
GraemeK

13 May 2014 at 6:48am Community Member, 3 Posts

Hi

I've built a silverstripe site which is being hosted on a distributed infrastructure. Now it's deployed for testing I'm having issues with maintaining Session states across the boxes.

I've implemented memcache for the frontend stuff, and that is working well.

However, when a user logs into the CMS their logged in status is not being maintained. I presume the stuff that handles this is using Session??

Where can I switch the user authentication to instead use my Memcache server??

Cheers!

Avatar
Tim Snadden

15 May 2014 at 8:35pm Community Member, 32 Posts

From memory I resolved what may be the same problem as follows (in mysite/_config.php).

   // If this is not set, the path in cookie will be empty and logins
   // will fail
   Session::set_cookie_path('/');
   Director::setBaseURL('/');

Avatar
GraemeK

16 May 2014 at 4:40am Community Member, 3 Posts

Cheers!

For reference, I solved this issue, by overriding the framework/security folder by copying it into mysite/ .

I then did a find replace on all instances of Session::{function-name}, and replaced them with an appropriate Memcache function.

I also had to instantiate the Memcache servers in Main.php.

Fun times...

But it works.

Avatar
Tim Snadden

19 May 2014 at 7:53am Community Member, 32 Posts

I'm glad you got it solved. You may want to have a look at Object::useCustomClass(). That way you could use your own customised version of the Session class that makes use of memcached without having to hack the framework.

Avatar
GraemeK

19 May 2014 at 8:51pm Community Member, 3 Posts

Great stuff thanks! I'll check it out.