{"record":{"id":"6106ca2d4c1f94d7","repo":"microsoft/qlib","slug":"unknown-memcache-unit","errorCode":null,"errorMessage":"Unknown memcache unit","messagePattern":"Unknown memcache unit","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"qlib/data/cache.py","lineNumber":173,"sourceCode":"            klass = MemCacheLengthUnit\n        elif limit_type == \"sizeof\":\n            klass = MemCacheSizeofUnit\n        else:\n            raise ValueError(f\"limit_type must be length or sizeof, your limit_type is {limit_type}\")\n\n        self.__calendar_mem_cache = klass(size_limit)\n        self.__instrument_mem_cache = klass(size_limit)\n        self.__feature_mem_cache = klass(size_limit)\n\n    def __getitem__(self, key):\n        if key == \"c\":\n            return self.__calendar_mem_cache\n        elif key == \"i\":\n            return self.__instrument_mem_cache\n        elif key == \"f\":\n            return self.__feature_mem_cache\n        else:\n            raise KeyError(\"Unknown memcache unit\")\n\n    def clear(self):\n        self.__calendar_mem_cache.clear()\n        self.__instrument_mem_cache.clear()\n        self.__feature_mem_cache.clear()\n\n\nclass MemCacheExpire:\n    CACHE_EXPIRE = C.mem_cache_expire\n\n    @staticmethod\n    def set_cache(mem_cache, key, value):\n        \"\"\"set cache\n\n        :param mem_cache: MemCache attribute('c'/'i'/'f').\n        :param key: cache key.\n        :param value: cache value.\n        \"\"\"","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/data/cache.py#L155-L191","documentation":"Error \"Unknown memcache unit\" thrown in microsoft/qlib.","triggerScenarios":"This error is raised at qlib/data/cache.py:173 when the guard condition fails: \"Unknown memcache unit\". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.","commonSituations":"See trigger scenarios.","solutions":["Use a supported memcache unit (e.g. a positive int for size limit or the supported unit strings).","Check your memcache configuration and set a valid unit for cache size/length."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}