Support the ongoing development of Laravel.io →
Cache Database

Hi, Q1, Is there anyway i can see how Memcache works? with laravel? What does Laravel set in the Key & Value(Object?)

Q1.1 I assume One Key one Query? How does it know / How do I handle the Keys?? A database for keys? for each new query?

Q2. You mean create a artisan command that does that (Query all users) & run it with cron Job?

Q3. The old Cache would be "updated/ Deleted" ?

Is Q1 the best way to do it? Or is it possible for the to SET/ADD it manually directly? It's hard to feel comfortable to not know what the code is doing or how it's done. I would totally love it if you could share it with us :D Thank you!


Every 15 mins , I plan to run a query every 15min , it has quite abit of join and union which I don't want to be loaded on real time.

How do I run this query in advance for my users so when they call the page of that query , it will get data from memcached instead.

Question 1 Let's say it's possible , am I right to say that the old cache of the same query would be replaced by the new one ?

@zenry Reply : yes

Question 2 I'm aware that I can actually set a cache , what do I set or should I just call it from controller for it to be cached for 15 minutes.

@zenry Reply : maybe a artisan command is better and then schedule it with a Cron job

Question 3

If I do a remember (15) what happens after 15min?

@zenry Reply : the database would be hit again

Last updated 3 years ago.
0
Solution
  • q1: yes
  • q2: maybe a artisan command is better and then schedule it with a Cron job
  • q3: the database would be hit again
Last updated 3 years ago.
0

zenry said:

  • q1: yes
  • q2: maybe a artisan command is better and then schedule it with a Cron job
  • q3: the database would be hit again

Hi,

Q1, Is there anyway i can see how Memcache works? with laravel? What does Laravel set in the Key & Value(Object?) Q1.1 I assume One Key one Query? How does it know / How do I handle the Keys?? A database for keys? for each new query?

Q2. You mean create a artisan command that does that (Query all users) & run it with cron Job? Q3. The old Cache would be "updated/ Deleted" ?

Is Q1 the best way to do it? Or is it possible for the to SET/ADD it manually directly? It's hard to feel comfortable to not know what the code is doing or how it's done. I would totally love it if you could share it with us :D

Thank you!

Last updated 3 years ago.
0

look at http://laravel.com/docs/cache

you can set memcache in app/config/cache.php

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.