Jump to content

Article Review - Session Caching in PHP


Recommended Posts

I wrote a short article/tutorial about session caching in PHP and was just looking for tips on both my code and my article.

Any feedback would be great please.




I also wrote one on how to do cross-domain ajax calls using jquery.






Link to comment
Share on other sites

Also the class name implies it's something it's not and your class actually violates SRP and the OCP principle. Since your class is responsible for both _SESSION and encryption of the data. Everytime the encryption of your session changes you have to go in the sessioncache class and change it, which is more prone to break existing code.

Link to comment
Share on other sites

Thorpe: It just makes it easier to store items in a session and retrieve them when implementing on a website where you are unsure of the possible $_SESSION index names. It's basically just a few functions to manage a sites session caching instead of a user writing their own. Would only take a few minutes to re-create the functions yourself so I can see how it may seem pointless.


ignace: I'm afraid I don't see how the class name is misleading, could you please expand. Thank you for the links I'm not very experienced in OOP design or guidelines such as them so will be good for me to learn.

Link to comment
Share on other sites

All caching methods have to store the data in some form of file. I can see how a user could mis-interpret the name as a way to cache a session instead of a way to cache data using sessions, i think that is what you're going for


Yes, I have to agree.  I think it's fine if you're trying to do something more with base sessions, for example adding namespacing as the zend_session does, but caching is highly misleading, because there is arguably no caching going on in your class.


If it was clearer what problems you were trying to solve, and what benefit this approach has over the use of basic sessions, I think the article would be a lot more valuable.  As it is now, it's hard to provide much positive feedback.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.