473,786 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unclear on memcached ?


I understand that memcached can store objects on different servers
using hashing, and I've seen typical things such as storing query
results.

Say at line 100 in module 'A', I want to render some content so I
check the memcache. If previously I had rendered this from this same
line of code and it's in the cache, then I use that. However, what if
module B changed one of the records on the database and that was in
the cache ? It must be up to me to have a scheme worked out that I
will delete the object from the cache that is referenced from module A
because I changed the database.

Mar 16 '07 #1
3 1454
surfivor wrote:
>
I understand that memcached can store objects on different servers
using hashing, and I've seen typical things such as storing query
results.

Say at line 100 in module 'A', I want to render some content so I
check the memcache. If previously I had rendered this from this same
line of code and it's in the cache, then I use that. However, what if
module B changed one of the records on the database and that was in
the cache ? It must be up to me to have a scheme worked out that I
will delete the object from the cache that is referenced from module A
because I changed the database.
Hi,

Sorry if I sound stupid because I never worked with memcache, BUT isn't this
excactly the kind of thing where you need a database?
A database will handle your concurrency, possible changed tuples, etc just
fine.

You can even store the results of a query in the database if you want, and
just update that when needed (= when the underlying data changes).

Regards,
Erwin Moller
Mar 16 '07 #2
Erwin Moller wrote:
You can even store the results of a query in the database if you want, and
just update that when needed (= when the underlying data changes).
Yes, but memcache is a lot faster than any SQL engine. The only thing
that could match the speed would be a memory storage engine as
implemented in MySQL - for simple pkey indexing I think it still
couldn't match memcache.

So RDBS gives you much more flexibility and scalability but at the cost
of complexity you might not need.

However in this case I would go for MySQL + memory storage engine.

--
Cz.
Mar 16 '07 #3
On Mar 16, 5:21 am, Czapi <c...@ask.mewro te:
Erwin Moller wrote:
You can even store the results of a query in the database if you want, and
just update that when needed (= when the underlying data changes).

Yes, but memcache is a lot faster than any SQL engine. The only thing
that could match the speed would be a memory storage engine as
implemented in MySQL - for simple pkey indexing I think it still
couldn't match memcache.

So RDBS gives you much more flexibility and scalability but at the cost
of complexity you might not need.

However in this case I would go for MySQL + memory storage engine.

--
Cz.

Thanks, but I asked the question as a hypothetical to try to
understand how memcached works. At this point, I am not sure all the
possible scenarios we may use it in, but I have seen many examples on
the web where it caches SQL query results.
It's my impression that the examples of memcached where the cache is
set to expire in 10 seconds will work if there is an update somewhere
else, say that part of what you are saving is data and the data is
upated someplace else where a new record is added to the database. A
page that is rendered within the 10 seconds may not show the new data,
but it's ok because after 11 seconds, any rendering will reflect the
new data. However, It occured to me that if a record was deleted and
then a page was rendered 5 seconds later that showed the old record.
If it was say on a blog and someone tried to update a comment based on
the old record, there will be a problem because now it is gone. This
seems to imply in some cases you can let the old pages expire, in
others you may have to expire them yourself which is more complex.
Ideally you might like to find as many cases that favor the other
approach.

Memcached seems like the best general solution to caching that I have
come across in that it is very low level. In some cases it may be
overkill and be slightly slower for moderate caching than other
approaches, but it is probably more extendable to the case where you
experience a moderate amount of traffic initially which then grows
into greatly increased traffic. You may have to monitor traffic
patterns and make changes, but your general caching archetecture may
not change. Some other caching schemes seem high level, but if there
is a bug or you create a problem by customizing the open source code
of some product or using various plugins with Wordpress, you could
break some of the other caching schemes such as the caching plugin
that wordpress has.


Mar 16 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2795
by: Little Twin Star | last post by:
Hello all A questions from 10,000ft: I'm looking to use memcached as a Cache::Cache. Looks like I'll need to wrap Cache::Memcached to conform to the Cache::Cache interface...? Has this been done somewhere (and I've missed it?)?
1
4151
by: Gilles Ganault | last post by:
Hello I'd like to play with MemcacheD and see how it improves read access to data, but I'm a bit lost at how to get from a working Apache2 + PHP5 + MySQL5 server on FreeBSD 6.3. I've never used PECL and PEAR before, and they seem required to install MemcacheD. I just ran "make config ; make ; make install" to build the php5 and
3
6745
by: bigqiang | last post by:
Memcached is a high-performance, distributed memory object caching system. its website is http://www.danga.com/memcached/ . How to use Memcached in Classic Asp? Help thanks .
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.