I found the issue when using entitycache module with filecache. Filecache expects cid to be a string but entitycache is passing it as a integer. This is causing entitycache module to not able to persist cache. Since cid has not been defined as a string in Drupal core so I am not expecting any caching module to pass it necessarily as a string. I would suggest the below patch to fix this issue for the time being.

Index: filecache.inc
===================================================================
--- filecache.inc	(revision 1)
+++ filecache.inc	(revision 2)
@@ -218,7 +218,7 @@
    *   The cache or FALSE on failure.
    */
   function get($cid) {
-    if (!$this->ok || !is_string($cid)) {
+    if ( ( ! $this->ok ) || ( ! ( is_string($cid) || is_integer($cid) || is_float($cid) ) ) ) {
       return FALSE;
     }
 
@@ -322,7 +322,7 @@
    *     the given time, after which it behaves like CACHE_TEMPORARY.
    */
   function set($cid, $data, $expire = CACHE_PERMANENT) {
-    if (!is_string($cid)) {
+	  if ( ! ( is_string($cid) || is_integer($cid) || is_float($cid) ) ) {
       return;
     }
 

Comments

shubhraprakash created an issue. See original summary.

shubhraprakash’s picture

Issue summary: View changes
shubhraprakash’s picture

Issue summary: View changes
shubhraprakash’s picture

Updated the patch in the issue.

shubhraprakash’s picture

Issue summary: View changes
apaderno’s picture

Version: 7.x-1.0-beta6 » 7.x-1.x-dev
Issue tags: -cache not being set, -entitycache, -cid needs to be string
delacosta456’s picture

hi @shubhraprakash

i was not seeing bins in some folders , like sites_default_cache_entity_node and after using your code things looks to be ok now (for some bin folder too).

however there is still nothing in folder sites_default_cache_block. could it be because of block cache not set at performance settings ?

Also after using your code, i can see that cache bins are represented by their cid... if it make sense i would like to suggest better naming. for example in folder sites_default_cache_menu cache id looks like this links@user-menu@page@taxonomy=term=28@fr@1@1

By the way many many many thanks for your code

Thanks

delacosta456’s picture

hi
this is definitely a bug that i also have with non-dev version of this module.
Can somebody help please with a correct patch ?

Thanks