Elviss Strazdins Sun Oct 17 16:00:45 -0400 2010
For those of you, who too need this functionality, for now you can do it like this:
1 class Item extends ActiveRecord\Model
2 {
3 public static function find()
4 {
5 $args = func_get_args();
6 if (data_found_in_memcache)
7 {
8 $result = data_from_memcache;
9 }
10 else
11 {
12 $result = call_user_func_array('parent::find', $args);
13 write_data_to_memcache;
14 }
15 return $result;
16 }
17 }
(1-1/1)
Subject: before_find and after_find callbacks
Hi!
Thanks for great work on Php.ActiveRecord. I found it about a week ago and decided to use it in my project. But I need to cache all my data with memcache, so it would be great if you could implement befor_find and after_find callbacks, so that it would be possible to try to read data from memcache in before_find callback and write data to memcache in after_find.
Thanks in advance!