[[["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-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eMemcacheService.SetPolicy\u003c/code\u003e defines strategies for handling cache replacements during \u003ccode\u003eMemcacheService#put\u003c/code\u003e operations.\u003c/p\u003e\n"],["\u003cp\u003eThere are three static field options for setting the policy : \u003ccode\u003eADD_ONLY_IF_NOT_PRESENT\u003c/code\u003e, \u003ccode\u003eREPLACE_ONLY_IF_PRESENT\u003c/code\u003e, and \u003ccode\u003eSET_ALWAYS\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eADD_ONLY_IF_NOT_PRESENT\u003c/code\u003e prevents race conditions by only adding a value if it's not already present.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSET_ALWAYS\u003c/code\u003e will always store the new value, discarding and replacing any existing value with the same key.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003evalueOf(String name)\u003c/code\u003e and \u003ccode\u003evalues()\u003c/code\u003e are the two available static methods provided.\u003c/p\u003e\n"]]],[],null,["# Enum MemcacheService.SetPolicy (2.0.0)\n\n public enum MemcacheService.SetPolicy extends Enum\u003cMemcacheService.SetPolicy\u003e\n\nCache replacement strategies for [MemcacheService#put](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService#com_google_appengine_api_memcache_MemcacheService_put_) operations,\nindicating how to handle putting a value that already exists. \n\nInherited Members\n-----------------\n\n[Enum.\\\u003cT\\\u003evalueOf(Class\\\u003cT\\\u003e,String)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#valueOf-java.lang.Class-java.lang.String-) \n[Enum.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#clone--) \n[Enum.compareTo(E)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#compareTo-E-) \n[Enum.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#equals-java.lang.Object-) \n[Enum.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#finalize--) \n[Enum.getDeclaringClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#getDeclaringClass--) \n[Enum.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#hashCode--) \n[Enum.name()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#name--) \n[Enum.ordinal()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#ordinal--) \n[Enum.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#toString--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)"]]