Questions tagged [memcached]

14 questions
15
votes
2 answers

Using Memcached: is it good practice to update the cache when updating the database?

This question is about best practices in architecture. Our Current Architecture I have a PHP class that accesses MySQL for user info. Let's call it User. User is accessed many times, so we have implemented layers of caching to reduce load. The…
Stephen
  • 2,200
  • 6
  • 22
  • 24
14
votes
2 answers

Shared Cache - Invalidation Best Practice

I'd like to know what would be a better approach to invalidate/update cache objects. Prerequisites Having remote memcached server (serving as cache for multiple applications) All servers are hosted by azure (affinity regions, same data…
lurkerbelow
  • 1,009
  • 1
  • 10
  • 19
10
votes
2 answers

How does key-based caching work?

I recently read an article on the 37Signals blog and I'm left wondering how it is that they get the cache key. It's all well and good having a cache key that includes the object's timestamp (this means that when you update the object the cache will…
Dominic Santos
  • 209
  • 1
  • 3
9
votes
2 answers

How would you design a “multithreaded” LRU cache using C++ (unordered_map and Linkedlist)?

Please note that this is about a thread-safe LRU cache (not simply a LRU cache as specified in https://leetcode.com/problems/lru-cache/description/). It isn't a duplicate of LRU cache design question as there are some tricky aspects of Locking…
7
votes
1 answer

Atomic Memcache Operations in PHP

This post is a follow up to this question: PHP Atomic Memcache on StackOverflow. Considering I am using Memcache (no d at the end) on PHP 5.3.10, I implemented a custom locking system where a client will wait until a lock key is destroyed before it…
Kovo
  • 173
  • 1
  • 5
6
votes
2 answers

Possibility of stale data in cache-aside pattern

Just to re-cape cache-aside pattern it defines following steps when fetching and updating data. Fetching Item Return the item from cache if found in it. If not found in cache, read from data store. Put the read item in cache and return…
Ammar
  • 161
  • 3
3
votes
4 answers

Architecture change from using disk to RAM to read and write key/value pairs coming over a network

A WebApp writes a stream of data coming over a network to disk as key/value pair and then reads & send it over network again after few milliseconds in 99% of case. In 1% of cases write/read can be few hours to days apart (really don't know). Latency…
2
votes
1 answer

Is there a way to group keys when using Memcached?

I use Memcache to store content lists with very key combinations, when user edited the content, I must refresh the cache, but it is hard to say what particular list to refresh, it is not either a good idea to flush the entire Memcache server, so my…
Yu Jiaao
  • 131
  • 4
1
vote
0 answers

Architect Java Hashmap Hierarchy to its equivalent in Redis Cache?

I have the following Job class representing runs of a job. I have a list of start and end times in Job class because the same Job can be rerun. public class Job { private final List jobStartTimes = new SortedList<>(); …
ThinkGeek
  • 119
  • 9
1
vote
1 answer

Memcache queries run on a cron job?

I have several queries that leverage storing data in memcached. Does it makes and is it against best practices to run a cron job to run these queries say every 15 minutes to keep the cache updated? Currently our cache expires every 30 minutes, and…
KingKongFrog
  • 111
  • 2
0
votes
1 answer

store single big object in memcached vs multiple keys

I have following large object (20KB) cached in memcache - Product : { BasicInfo, //~5KB SellerId, //int CityId, //int AdditionalInfo //~15KB } This is being accessed at multiple places- At some place, only sellerId or cityId…
ctor
  • 101
  • 2
0
votes
1 answer

design for buffering or queuing data streams to replace database

We have a system (ms stack, .net, sql) that receives data from thousands of remote devices (several independent readings/min). We currently save all the data to a db as it arrives and a second service reads and processes the data - using the…
Matt
  • 153
  • 7
0
votes
2 answers

Basic memcached question

I have been reading up on distributed hashing. I learnt that consistent hashing is used for distributing the keys among cache machines. I also learnt that, a key is duplicated on mutiple caches to handle failure of cache hosts. But what I have come…
Aadith Ramia
  • 157
  • 1
  • 4
0
votes
3 answers

Solutions for "Maintenance Mode"

Given a web application running across 10+ servers, what techniques have you put in place for doing things like altering the state of your website so that you can implement certain features. For instance, you might want to: Restrict Logins/Disable…
Kare Lyse
  • 9
  • 1