开发者

C#.NET Memcached: Add item with file dependency?

We've got a web farm of 12 servers, all running the exact same site.

We've got a file, let's say config.xml, that's identical on all 12 servers. The contents is stored in memcached (via Enyim client).

Whenever this file changes, on any of the 12 servers, the cached version of this file should be purged and replaced with the new version's开发者_Go百科 contents.

To do this, each web server uses a FileSystemWatcher and watches its version of config.xml, and removes the cached contents if that file changes.

When we want to change config.xml, we upload a new version to all 12 web servers. The problem is that each web server detects the change with its FileSystemWatcher, and all 12 web servers remove the cached value, and put in the new contents value.

In other words, the purge-on-file-change cache dependency executes 12 times when we only want it to execute once (because all 12 copies are the same).

What's a solution?


Let the servers get the contents of the cache, compare it to the file, and only alter it when the content of memcache doesn't match the content of the file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜