Post by straightlight » Mon Apr 07, 2014 9:14 am

These instructions were meant for older versions of OpenCart. I will update this topic shortly.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by storm-cloud » Mon Apr 07, 2014 9:33 am

Thank you Straightlight, that would be fantastic!

DB caching is not something I am familiar with so excuse the questions, but I noticed that when making changes to HTML code (within category pages etc.) that this did not take effect. Obviously due to the DB being cached.

1) What is the best method to allow code changes such as this?

2) This modification also appears to cache stock quantity, therefore increasing the likelihood that stock will be oversold. Is there a way in which this could be excluded from the cache?

3) I assume this "define('DB_CACHED_EXPIRE', 120);" means that the cache will expire in 2 minutes. Should this be increased for further performance benefit?

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am

Post by straightlight » Fri Apr 11, 2014 9:30 am

I'm not the original author of this contribution though.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Thu Jun 12, 2014 7:31 pm

One question. the mysql_cached.php file , as downloaded from

https://github.com/shaman/opencart-mysq ... 8312ce0541

shows a '<?php' in the first line, but I see not PHP Ending '?>' anywhere to close the PHP Sequence.

Is the PHP Close Tag just missing or does it NEED to 'stay open'?

Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Thu Jun 12, 2014 8:17 pm

When comparing both statement from the browser, do you see any difference?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by OSWorX » Thu Jun 12, 2014 8:22 pm

IP_CAM wrote:One question. the mysql_cached.php file , as downloaded from

https://github.com/shaman/opencart-mysq ... 8312ce0541

shows a '<?php' in the first line, but I see not PHP Ending '?>' anywhere to close the PHP Sequence.

Is the PHP Close Tag just missing or does it NEED to 'stay open'?

Ernie
If the file is plain (pure) php code, no closing tag is needed.
Enough resources in the net or at php.net itself to read about correct coding.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by IP_CAM » Fri Jun 13, 2014 8:43 am

straightlight wrote:When comparing both statement from the browser, do you see any difference?
if you meant me, I have no idea, if it works...

I installed the "config.php"-Lines here:

Code: Select all

// DB
define('DB_DRIVER', 'mysql');
define('DB_DRIVER', 'mysql_cached');
define('DB_CACHED_EXPIRE', 120);
define('DB_HOSTNAME', '....... 
leaving the;

Code: Select all

define('DB_DRIVER', 'mysql');
because, without it, I got an broken site.
Then, I installed the

Code: Select all

mysql_cached.php
into the "/shop/system/library/" - sub.

I tried the:

Code: Select all

mysql_cached.php
with and without the:

Code: Select all

 ?>
PHP End Tag as well.

There I am now, no errors, no nothing, it just works as ever.
SInce I only have 4 sample Products, Pageload was before already well below 3 Seconds,
PingDom gave me the same results as before, so, I really don't know if it works...

Ernie

@OSWorX: keine Ahnung, was als 'Pure PHP Code' bezeichnet wird,

Code: Select all

if ($resource) {
  if (is_resource($resource)) {
  $i = 0;
  $data = array();
  while ($result = mysql_fetch_assoc($resource)) {
  $data[$i] = $result;
  $i++;
 }}
sowas würde auch in Perl fast genau gleich aussehen..., ich bin (leider) nur Oberflächen-Taucher...

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by OSWorX » Fri Jun 13, 2014 4:44 pm

IP_CAM wrote:@OSWorX: keine Ahnung, was als 'Pure PHP Code' bezeichnet wird,

Code: Select all

if ($resource) {
  if (is_resource($resource)) {
  $i = 0;
  $data = array();
  while ($result = mysql_fetch_assoc($resource)) {
  $data[$i] = $result;
  $i++;
 }}
sowas würde auch in Perl fast genau gleich aussehen..., ich bin (leider) nur Oberflächen-Taucher...
Wenn ein Script nur (plain / pure) php-Code enthält, benötigt es kein abschliessenden Tag "?>"
Anders wenn es gemischt ist, z.B. HTML & php usw. dann muss der jeweilige php-Code sehr wohl auch beendet werden "?> da ansonsten der Parser sich nicht mehr auskennt.

Deshalb wird es mit OC 2 keinen Schlusstag mehr geben.
Wichtig ist auch dass nach der letzten Codezeile keine leere Zeile ist!

Der Sinn dahinter ist auch dass jedemal wenn ein Schlusstag vorhanden ist,d er php-Parser von neuem anfangen muss zu arbeiten -> spart also auch Zeit.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by IP_CAM » Mon Apr 06, 2015 5:56 am

Hello all here, after a while,
I never got this to work,because I changed the DB Engine to:

Code: Select all

define('DB_DRIVER', 'mysqli');
Now, I would like to find out, if this can be modified/used for MySqli in any way.

Thank you
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by IP_CAM » Wed May 27, 2015 10:38 am

Finally, I found the DB-Cache solution for OpenCart version 1.5.6.x !

It worked well! The Problem was, when I came home, a few hours later, my Site was so slow, something must have happened. I found a Cache Folder, containing thousands of files, back to the first file, when I started doing tests.
Must be in relation with the time, set, or then, the cache-remove function has just not been working.
To get more info on this check here:

http://www.opencarto.com/other/cache-yo ... cache.html
https://github.com/shaman/opencart-mysql-cache
https://www.google.ch/search?q="define( ... "+opencart

Also, always get russian/ukrainian Sites translated by Google, you'll find important infos as well.

Ernie
bigmax.ch/os/

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: Amazon [Bot] and 82 guests