Handles deserialization errors. This method is called from either of the
get methods, if the retrieved value
cannot be deserialized. This normally indicates an application upgrade
since the cache entry was stored, and should thus be treated as a cache
miss, which is the behavior of LogAndContinueErrorHandler (the
default).
Handles back-end service errors. This method is called from most of the
MemcacheService methods in the event of a service error. This is
also called for MemcacheService#put(Object, Object) when the
combined key and value size is too large.
The handler may throw any RuntimeException, or it may simply
return for "permissive" error handling, which will generally emulate
behavior of a cache miss due to a discarded entry.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eConsistentErrorHandler\u003c/code\u003e is a marker interface that ensures all \u003ccode\u003eMemcacheServiceException\u003c/code\u003e exceptions are handled by \u003ccode\u003eErrorHandler#handleServiceError(MemcacheServiceException)\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eConsistentErrorHandler\u003c/code\u003e extends the existing \u003ccode\u003eErrorHandler\u003c/code\u003e to specifically handle \u003ccode\u003eMemcacheServiceException\u003c/code\u003e exceptions thrown by methods like \u003ccode\u003eMemcacheService#put(Object, Object)\u003c/code\u003e while maintaining backward compatibility.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ehandleDeserializationError(InvalidValueException ivx)\u003c/code\u003e deals with situations where retrieved values cannot be deserialized, often due to application upgrades, treating it as a cache miss.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ehandleServiceError(MemcacheServiceException ex)\u003c/code\u003e manages back-end service errors, including cases where the combined size of the key and value in \u003ccode\u003eMemcacheService#put(Object, Object)\u003c/code\u003e is too large.\u003c/p\u003e\n"]]],[],null,["# Interface ConsistentErrorHandler (2.0.0)\n\n public interface ConsistentErrorHandler extends ErrorHandler\n\nA marker interface to indicate that all [MemcacheServiceException](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheServiceException) exceptions should be\nhandled by [ErrorHandler#handleServiceError(MemcacheServiceException)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.ErrorHandler#com_google_appengine_api_memcache_ErrorHandler_handleServiceError_com_google_appengine_api_memcache_MemcacheServiceException_). This interface was\nadded to enable handling [MemcacheServiceException](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheServiceException) thrown by the various [MemcacheService#put(Object, Object)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService#com_google_appengine_api_memcache_MemcacheService_put_java_lang_Object_java_lang_Object_) methods while preserving backward compatibility with [ErrorHandler](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.ErrorHandler) which did not handle such cases. \n\nImplements\n----------\n\n[ErrorHandler](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.ErrorHandler)\n\nMethods\n-------\n\n### handleDeserializationError(InvalidValueException ivx)\n\n public abstract void handleDeserializationError(InvalidValueException ivx)\n\nHandles deserialization errors. This method is called from either of the\n[get](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService#com_google_appengine_api_memcache_MemcacheService_get_java_lang_Object_) methods, if the retrieved value\ncannot be deserialized. This normally indicates an application upgrade\nsince the cache entry was stored, and should thus be treated as a cache\nmiss, which is the behavior of [LogAndContinueErrorHandler](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.LogAndContinueErrorHandler) (the\ndefault).\n\n### handleServiceError(MemcacheServiceException ex)\n\n public abstract void handleServiceError(MemcacheServiceException ex)\n\nHandles back-end service errors. This method is called from most of the\n`MemcacheService` methods in the event of a service error. This is\nalso called for [MemcacheService#put(Object, Object)](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService#com_google_appengine_api_memcache_MemcacheService_put_java_lang_Object_java_lang_Object_) when the\ncombined key and value size is too large.\n\nThe handler may throw any [RuntimeException](https://docs.oracle.com/javase/8/docs/api/java/lang/RuntimeException.html), or it may simply\nreturn for \"permissive\" error handling, which will generally emulate\nbehavior of a cache miss due to a discarded entry."]]