hi every one
yii provide a cache dependency method "means that cache can be invalidated if dependency is not the same as in cache"
one of these dependency method is CDbCacheDependency which execute database query and compare result to dependency stored in cache
but one of the main important points in caching in general that it decrease load on db by decrease number of queries depending on cached query
so if we use CDbCacheDependency i think we are not doing any thing by cache even if the returned value is the from database query is small
i think that if we create a method for deleting cache on update will be better in case of using database dependency
as it will enforce query to execute again
an example of that in my opinion is when you store user sessions in database you need to validate these session with every request sent from user "for security not depending on cookies alone"<this will cause overload on database
i open discussion for this topic to get the best practice using cache dependency.
thanks
yii provide a cache dependency method "means that cache can be invalidated if dependency is not the same as in cache"
one of these dependency method is CDbCacheDependency which execute database query and compare result to dependency stored in cache
but one of the main important points in caching in general that it decrease load on db by decrease number of queries depending on cached query
so if we use CDbCacheDependency i think we are not doing any thing by cache even if the returned value is the from database query is small
i think that if we create a method for deleting cache on update will be better in case of using database dependency
as it will enforce query to execute again
an example of that in my opinion is when you store user sessions in database you need to validate these session with every request sent from user "for security not depending on cookies alone"<this will cause overload on database
i open discussion for this topic to get the best practice using cache dependency.
thanks