Force get_option to read from the DB instead of cache
-
I have a plugin with a bulk updater that loops through all images. Currently the bulk updater runs in the browser and makes ajax calls. I am keeping track of the progress by storing a progress indicator (a number) in the database.
During each run, the previous progress indicator is read, incremented by one, and saved back to the database.
On servers with object caching enabled, the data that is being read is the cached value and not the one saved in the database. This causes issues sometimes where the same image keeps on getting updated instead of progressing to the next.
Any idea how to solve this? Please suggest a better solution too, if there is one.
Currently I am using
get_option
to read the saved number andupdate_option
to write the updated number back into the database.Side note, I found this thread with some ideas, but none of them seems to be comprehensive – https://wordpress.stackexchange.com/questions/100040/can-i-force-get-option-to-go-back-to-the-db-instead-of-cache
Thanks in advance for your time.
- The topic ‘Force get_option to read from the DB instead of cache’ is closed to new replies.