views:

777

answers:

1

Background

I'm currently developing an online community and I want to store some temporary information in a hash table. Currently this information is being stored in memcached, however, should the memcached service need to be restarted or failed, I would like to resort back to the on disk hash/cache.

The Question

What is the most effective method of implementing an on disk Hash or Cache table in MySql? Are there any techniques that I can use to get out of a simple table which will have the following fields:

  • Hash Value
  • Stored Value
  • Expiry Date

Any help or insight would be much appreciated.

Clarity

  • I won't be storing any complex data objects, just simple text strings.
  • My current plan is to implement an InnoDB table.
  • Any links to articles on a similar topic would be a bonus.
+3  A: 

You already laid out most of the solution for now: one table, three columns (probably a fourth that's a meaningless integer ID for a primary key), and an index on the hash value column. Ask again later when you have a testable / fixable problem to overcome.

"...premature optimization is the root of all evil" -Knuth

Alkini
"...premature optimization is the root of all evil" I concur!
GateKiller