Unit Tests for Cache Class
| From: | Sebastian Detert | Date: | Wed, 26 Jan 2011 10:05:43 +0000 |
| Subject: | Unit Tests for Cache Class | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-311036@lists.php.net to get a copy of this message | ||
Hi all,
I'm just writing a small cache class to optimize my database connection. I want to use three different stages to store and receive my data as fast as possible.
1) fast
get data from class variable if existing
2) mid
get data from memcache if existing
-> save result as class variable
3) slowest:
sql query -> receive data from database
-> save result to memcache
-> save result as class variable
How would you write (unit) tests for such a class? What is the best way to prove, that all data was stored correctly, even after data manipulations like insert/update/delete?
I'm looking forward to your suggestions,
Sebastian