Sqlite db and some in-memory cache systems

I am comletely unfamiliar with sqlite3. I want to use Doctrine Cache to cache some data in sqlite3 db. How can I create a sqlite db with tables with some fields in it? Any help please?

Is here someone who has a in memory cache system like Apc, Memcache, Redis, Xcache who can help me testing a script with Doctrine Cache? I cannot do it myself because they are available only in private or dedicated servers. I appreciate any help.

What is your main database? MySQL? If so, I would not recommend SQLite as cache, because cache storage is supposed to faster to regular storage, but SQLite is slower than MySQL…

Uh, I was unaware! I know even file cache is better than mysql cache. I used benchmark and I see this is too much faster. Also Doctrine cache lib is too much faster than zend cache component. Do you have any in-memory cache like Apc, Redis, Memcache, Xcache or whatever?

You can also install it on your development machine to test :slightly_smiling_face:

I don’t have a development server or machine. I directly develop on my website!

And file cache faster than MySQL cache doesn’t seem right. Where did you find that?

Step 1. Get a local development environment. You’ll thank me later.

I calculated the runtime speed in milliseconds several times then get the average of all times and noticed file was faster. At least with Doctrine Cache it was so.

How big was the dataset? Did you try multiple data sets? How many times did you run the test? Where there no other processes running that might have influenced stuff? Etc etc.

What I’m saying is running some rudementary testing is not a benchmark and doesn’t prove anything.

The page had several Doctrine dql, Doctrine has the ability to cache query and metadata. I tried both mysql and file caching and noticed when I was using filecache, the page was faster. I also asked Doctrine guys why their Cache component has not mysql factory. They said because it will be slow and useless! Doctrine guys told me mysql cache will be slow!

Can you test it with Doctrine cache and let me know your conclusion?

Sure, caching DQL and meta data in MySQL doesn’t make sense, but caching it in SQLite makes even less sense, because SQLite is generally slower than MySQL and has some really weird concurrency stuff you need to be aware off.
If you don’t have access to something like Redis or Memcached I would keep it simple and stick with files.

What about caching qr code? Generating it on-fly each time is better or better to cache it in file or better to create physical image file?

What you’re serving to the user is a physical image file, so that’s what I would cache.

Actually this is not a physical image file, I use endroid/qrcode to generate qr on fly.
So you suggest I convert it to physical file and let twig to cache it, or if I don’t want physical image file, I cache it as file with Doctrine cache? Or better to just keep it as it is now to generate on fly?

Do you have a performance problem? If not, don’t cache it.

If you do, save the generated QR codes on disk somewhere and use those. Not through Twig, not trough Doctrine cache, just plain old image files.

What you also need consider with caching is whether the same information will be requested multiple times for average use cases.

If people generate a lot of QR codes, but they’re all different, it doesn’t make sense to cache them because the cache will almost never be hit.

However, if a lot of people generate a bunch of the same QR codes over and over then it makes sense to cache them.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.