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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Silverstripe CMS on a clustered server environment


Go to End


5 Posts   1690 Views

Avatar
GraemeK

Community Member, 3 Posts

13 May 2014 at 6:48am

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

Community Member, 32 Posts

15 May 2014 at 8:35pm

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

Community Member, 3 Posts

16 May 2014 at 4:40am

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

Community Member, 32 Posts

19 May 2014 at 7:53am

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

Community Member, 3 Posts

19 May 2014 at 8:51pm

Great stuff thanks! I'll check it out.