cacheId function

Extract the cache id of an object