[wp-hackers] Use of ENGINE=MEMORY w/ dbDelta() possible?

Mahmoud Al-Qudsi computerguru at neosmart.net
Mon Mar 24 03:57:03 GMT 2008

> To be fair, Its not my code, I just had it on the local drive, no idea
> where i got it from, i think it was posted to wp-hackers last year.

Fair enough ;-)

> Expirations ARE needed, else the blog would continuously show the same
> data at that point in time, no changes afterwards.. WP only ever used
> 5minute expirations though, And some parts of the code (posting and
> commenting) delete the cached data too, but many things dont delete,
> just use if its cached.

Yeah I know. I was just questioning whether it is worth investing extra time in doing so if there is no point to a MySQL cache in the first place.
> ON DUPLICATE is a good way actually, I think it might be slower though,
> i'm not sure.

It's either INSERT INTO .... ON DUPLICATE, REPLACE INTO, or DELETE FROM ... INSERT INTO. From what I gleamed from the MySQL docs, ON DUPLICATE is the most efficient way.

> I'm not sure why your base64 encoding it though, surely that'd be slow?
> As long as its utf8, it should be able to store any characters you
> need, base64 encoding only adds extra overheads.

I have no idea either :S

I had originally $wpdb->escape()'d the data, then stripslashes()'d it in the get() function; but for some messed-up reason the deserializer kept breaking on the slashed-and-unslashed code. If you know why, I'd love to find out.

> Also, Some caches can be VERY large, some only small, I think i
> remember some people having upwards of 50MB's in file caches just for
> the object cache.

Individual files too? With a varbinary(4096), it has support for up to 4KiB in a single cache object. The problem (as I'm sure you know) is that MEMORY tables are fixed-row-size; so I can't use BLOB, LONGTEXT, etc.

> Here, i pulled up the old thread for you:
> http://groups.google.com/group/wp-
> hackers/browse_thread/thread/d8ca502a0d0e8fbd/3f3e5c442063d272?lnk=gst&
> q=memory+object+cache#3f3e5c442063d272

I'll look through it soon as I get the chance.


More information about the wp-hackers mailing list