How to use APC PHP-cache for Smarty 3.x in CMSMS?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
swgreed

How to use APC PHP-cache for Smarty 3.x in CMSMS?

Post by swgreed »

How can I use APC/APCU PHP in memory cache with CMSMS?

[*] nowadays, Smarty 3.1.x ships with a plugin in "/demo/plugins/cacheresource.apc.php" by default

[*] The Smarty forum offers a default solution for enabling this feature, see: http://www.smarty.net/forums/viewtopic.php?t=16809

Code: Select all

$smarty->loadCacheResource('apc');
$smarty->setCaching(true);
But I'm not sure how to combine this with Smarty within CMSMS?
Where do I put the above code?
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: How to use APC PHP-cache for Smarty 3.x in CMSMS?

Post by Jeff »

What are you looking for the code caching or the data store?

I don't know about the CMSms side of things, but in general APC is outdated.

What are your server specs that you are doing this on?
swgreed

Re: How to use APC PHP-cache for Smarty 3.x in CMSMS?

Post by swgreed »

Hi Jeff,

I'm looking for the place in the CMSMS source code to place these 2 lines (just for testing purpoises).

I came across APCu (i.e. APC micro) while playing around with Owncloud. Since my webhost supports APCu and Owncloud 8.2 urges you to enable it, it really boosts the website.
So I was curious, if Smarty would also support this. And it does.
I'm just not quite sure where to implement it.

Specs are as follows:
- Smarty 3.1.24 on CMSMS 1.12.1
- PHP 5.6.14
- APCu Support 4.0.7
apc.enabled On
apc.shm_size 32M
apc.writable /tmp
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: How to use APC PHP-cache for Smarty 3.x in CMSMS?

Post by calguy1000 »

a: it is against forum rules to discuss hacking CMSMS. Because it tends to cause more problems than it solves.

b: You are already running a hacked version of CMSMS, so are ineligible for support. (we do not distribute Smarty 3.1.24).
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
swgreed

Re: How to use APC PHP-cache for Smarty 3.x in CMSMS?

Post by swgreed »

I wasn't aware of "hacking" CMSMS (which implies a rather negative annotation) but keeping a 3rd party module up to date.
According to the changelog, the .24 release would also improve performance (i.e. "quick win").
Smarty 3.1.24 has a LONG list of new features, bug fixes and improvements since 3.1.21 (22 and 23 were never released publicly.) Most notably, compiling speed has been improved by 30-40% over the last release!
This is the "Developers Discussion" board (not "Product Support"), therefore I was curious for your thoughts and opinions and a possible hint where to put the 2 lines of code, so I can test it on my behalf.

I am not demanding a problem to solve but what I'm asking for is acutally a possible enhancement maybe worthwile for everyone.

The Smarty thread I mentioned was from 2010 when Smarty 3.0.x was just released. It's not specific to 3.1.16 or 3.1.24. Switching back to Smarty 3.1.16 (to a "non-hacked" state) raises the same question as in posting #1.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: How to use APC PHP-cache for Smarty 3.x in CMSMS?

Post by Jo Morg »

swgreed wrote:I wasn't aware of "hacking" CMSMS (which implies a rather negative annotation) but keeping a 3rd party module up to date.
According to the changelog, the .24 release would also improve performance (i.e. "quick win").
The libraries included in CMSMS are (with the exception of 3rd party modules in the modules folder that are not part of the installed package) considered as being part of the core, and are maintained as such. The Dev team has tested all the available versions of these libraries, and use only the ones that are considered stable to be used with CMSMS. We also may modify any of those libs to work better with each release of CMSMS. So there are reasons to use one version of a specific lib instead of a more recent one. And by updating any of the libraries by yourself you may be creating bigger problems than the ones you are trying to solve, and that is considered a hack.
swgreed wrote:The Smarty thread I mentioned was from 2010 when Smarty 3.0.x was just released. It's not specific to 3.1.16 or 3.1.24. Switching back to Smarty 3.1.16 (to a "non-hacked" state) raises the same question as in posting #1.
In practical terms all you need to know is on that topic, and there is no need to hack CMSMS in any way. There are several approaches possible, for instance with an UDT with those 2 lines of code being called by a "ContentPreCompile" event from the CMSMS core... I didn't test it but that should work as long as you add the plugin file to the plugins directory.
However I strongly recommend you to revert the Smarty lib to the original distributed library, otherwise you'll have issues that we won't be able to solve or assist you with.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

Return to “Developers Discussion”