Now should i cache very rows from mysql?
Posted: Fri Oct 14, 2011 6:12 pm
Hi, heres my table:
id refers to user, and every user have one row here
so stats should be selected very offten, since self user and other users can check stats in pre lobby
so i would to cache to prevent MySQL acesses, and renew cache when player finish a game
how should i cache this?
set a cache name per user like: "user1", "user2"?
another question: php save cache into files, and only put in memory when we access to it or its always on memory?
NOTE: Using APC
thanks
Code: Select all
CREATE TABLE `stats_css` (
`id` int(10) unsigned NOT NULL,
`reliability` tinyint(3) unsigned NOT NULL DEFAULT '100',
`ragequit` tinyint(3) unsigned NOT NULL DEFAULT '0',
`played` int(10) unsigned NOT NULL DEFAULT '0',
`won` int(10) unsigned NOT NULL DEFAULT '0',
`drawn` int(10) unsigned NOT NULL DEFAULT '0',
`lost` int(10) unsigned NOT NULL DEFAULT '0',
`assists` int(10) unsigned NOT NULL DEFAULT '0',
`kills` int(10) unsigned NOT NULL DEFAULT '0',
`deaths` int(10) unsigned NOT NULL DEFAULT '0',
`roundswon` int(10) unsigned NOT NULL DEFAULT '0',
`roundsdrawn` int(10) unsigned NOT NULL DEFAULT '0',
`roundslost` int(10) unsigned NOT NULL DEFAULT '0',
`headshots` int(10) unsigned NOT NULL DEFAULT '0',
`damagegiven` int(10) unsigned NOT NULL DEFAULT '0',
`damagerecived` int(10) unsigned NOT NULL DEFAULT '0',
`bombsdefused` int(10) unsigned NOT NULL DEFAULT '0',
`bombsplanted` int(10) unsigned NOT NULL DEFAULT '0',
`1man_played` int(10) unsigned NOT NULL DEFAULT '0',
`1man_won` int(10) unsigned NOT NULL DEFAULT '0',
`2man_played` int(10) unsigned NOT NULL DEFAULT '0',
`2man_won` int(10) unsigned NOT NULL DEFAULT '0',
`3man_played` int(10) unsigned NOT NULL DEFAULT '0',
`3man_won` int(10) unsigned NOT NULL DEFAULT '0',
`4man_played` int(10) unsigned NOT NULL DEFAULT '0',
`4man_won` int(10) unsigned NOT NULL DEFAULT '0',
`5man_played` int(10) unsigned NOT NULL DEFAULT '0',
`5man_won` int(10) unsigned NOT NULL DEFAULT '0',
`maps` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
CONSTRAINT `stats_css_ibfk_1` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ciso stats should be selected very offten, since self user and other users can check stats in pre lobby
so i would to cache to prevent MySQL acesses, and renew cache when player finish a game
how should i cache this?
set a cache name per user like: "user1", "user2"?
another question: php save cache into files, and only put in memory when we access to it or its always on memory?
NOTE: Using APC
thanks