We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Add value to cache, fetch, check? | Forum

Topic location: Forum home » Support » General Questions
Marcus
Marcus Jan 15 '19

How can I add value to cache and then on each page load check cache first instead of running query each time?


Why this aint working?


OW :: getCacheManager () -> save ('test', 'test_1', null, null);
echo OW :: getCacheManager () -> load ('test_1');



Question?


If cache uses database table then what's the point of using it appose to query the result??

The Forum post is edited by Marcus Jan 15 '19
Paul
Paul Jan 15 '19
Is the cache enabled? especially you are using debug mode


check this with "OW :: getCacheManager ()->getCacheEnabled();

Marcus
Marcus Jan 15 '19

Hi Dave it says 1 looks like it is enabled!


Do you know the answer to this question???


Question?


If cache uses database table then what's the point of using it appose to query the result??


If I am doing DB read with cache then it's not efficient.



This does work:


OW :: getCacheService () -> set ('test_1', 'jhkhkj', null);
echo OW :: getCacheService () -> get ('test_1');


Is cache doing DB read or smarty? I see it's reading DB ow_base_db_cache that's not efficient at all!


On each page load I checking if userid is in a table(plugin) if not execute plugin! I need to cache those ids so that I woun't need to read DB on each page load!

The Forum post is edited by Marcus Jan 15 '19
Paul
Paul Jan 15 '19
I dont know if I still understand your question, but yes. the cache is write in the base_db_cache.


take a look at /ow_system_plugins/base/bol/db_cache_*.php 

Marcus
Marcus Jan 15 '19

I am not an expert in all this but ain't cache suppose to be a separate independent from db storage some like smarty which stores locally o server all those temp values?


Is there a way to have cache on server file instead of db?


Case if I pull data from one table what's the point storing it in another!


Oxwall cache is like SQL Temporary table i suppose. In stead of creating temp table u would use cache! But that's not real cache!

The Forum post is edited by Marcus Jan 15 '19
Paul
Paul Jan 16 '19
Ok, I think my english is too bad :D 


You mean something like the memcache or redis?

Marcus
Marcus Jan 16 '19
Thats right memory cache? Does oxwall cache operate on the same principal? Thanks for your support paul

The Forum post is edited by Marcus Jan 16 '19
AppXprt
AppXprt Jan 16 '19
The server cache doesn't store variable or values per say like you're thinking, it pre-compiles templates and such and stores them for retrieval without having to regenerate constantly...


This happens for a lot of stuff like smarty templates, scripts, css etc..


What you are looking for is more like local storage or a Redis server for server side variable / storage..


You can set MySQL to supposedly cache queries:

MySQL Caching

Why it doesn't work like you think

The Forum post is edited by AppXprt Jan 16 '19
Marcus
Marcus Jan 16 '19
Is using oxwall cache in a way i described above faster than doing a new queey request to my table?
Mike
Mike Jan 16 '19
Why dont you create a value in the PHP Session object.

Or save a cookie?

Marcus
Marcus Jan 16 '19
To be honest i was just thinking about same thing! Whats better session or cookie?

It would be great if someone could post a tutorial on how to combine memcached with oxwall.

Gonna go with session cookies are not as reliable!
The Forum post is edited by Marcus Jan 16 '19
Mike
Mike Jan 16 '19

Depends on what you want.


Session is only as the browser is open.

Cookie can be saved also when you close the browser.

Marcus
Marcus Jan 16 '19
Thank yo all folks

ArtMedia
ArtMedia Jan 18 '19
Oxwall stopped using query caching in futher versions.
Marcus
Marcus Jan 20 '19
How crazy is that! Everybody is moving towards caching and they chose not to :)
AppXprt
AppXprt Jan 20 '19
Caching can cause issues...


Everyone wants PWA but doesn't understand that issues that come with it...


PWA Caching issues aren't the easiest to deal with either...


With that being said, WorkBox produces a lightning fast solution...

The Forum post is edited by AppXprt Jan 20 '19
Pages: 1 2 »