PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 13, 2022

[FIXED] How to update data in datastore, saved in the memcache?

 November 13, 2022     datastore, google-app-engine, google-cloud-datastore, memcached, php     No comments   

Issue

I am working on a datastore project on which I have to work with memcache. But because I never used memcache before so I am confused with it. I followed this link and successfully saved and retrieved values from memcache.

$memcache = new Memcache;
$value = $request->getContent();
return $memcache->set($key, $value);

and

$memcache = new Memcache;
return $memcache->get($key);

So this is enough for me when I want to only get a user's detail and save it into the memcache. But the problem is with inserting the values from memcache to database. Can anyone please guide me how should I approach it. Whether I should save the user's edits into the memcache when he makes them and when try to logout then I should first save all the changes into the datastore or there are some other solutions available to make changes later? Please help me.


Solution

Don't think of it as "inserting data from memcache to the database" - there is nothing specially for this. You're just inserting into the database (in the usual way) data which just happened to be retrieved from memcache.



Answered By - Dan Cornilescu
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing