--- /dev/null
+Subject: res_sorcery_memory_cache
+
+The SorceryMemoryCacheExpireObject AMI action and CLI
+command allow expiring of a specific object within the
+sorcery memory cache. This is done by removing the
+object from the cache with the expectation that the
+cache will then re-populate the object when it is next
+needed.
+
+For full backend caching this does not occur. The cache
+won't repopulate until an entire refresh is done resulting
+in the possibility that objects are missing until that
+time.
+
+The AMI action and CLI command will now not allow
+expiring of an object if the cache is configured as a
+full backend cache. Instead you must use either the
+SorceryMemoryCacheExpire or SorceryMemoryCachePopulate
+AMI actions or their associated CLI commands.
</parameter>
</syntax>
<description>
- <para>Expires (removes) an object from a sorcery memory cache.</para>
+ <para>Expires (removes) an object from a sorcery memory cache. If full backend caching is enabled
+ this action is not available and will fail. In this case the SorceryMemoryCachePopulate or
+ SorceryMemoryCacheExpire AMI actions must be used instead.</para>
</description>
</manager>
<manager name="SorceryMemoryCacheExpire" language="en_US">
remove_all_from_cache(cache);
ast_cli(a->fd, "All objects have been removed from cache '%s'\n", a->argv[4]);
} else {
- if (!remove_from_cache(cache, a->argv[5], 1)) {
+ if (cache->full_backend_cache) {
+ ast_cli(a->fd, "Due to full backend caching per-object expiration is not available on cache '%s'\n", a->argv[4]);
+ } else if (!remove_from_cache(cache, a->argv[5], 1)) {
ast_cli(a->fd, "Successfully expired object '%s' from cache '%s'\n", a->argv[5], a->argv[4]);
} else {
ast_cli(a->fd, "Object '%s' was not expired from cache '%s' as it was not found\n", a->argv[5],
}
ao2_wrlock(cache->objects);
- res = remove_from_cache(cache, object_name, 1);
+ if (cache->full_backend_cache) {
+ res = 1;
+ } else {
+ res = remove_from_cache(cache, object_name, 1);
+ }
ao2_unlock(cache->objects);
ao2_ref(cache, -1);
- if (!res) {
+ if (res == 1) {
+ astman_send_error(s, m, "Due to full backend caching per-object expiration is not available, consider using SorceryMemoryCachePopulate or SorceryMemoryCacheExpire instead\n");
+ } else if (!res) {
astman_send_ack(s, m, "The provided object was expired from the cache\n");
} else {
astman_send_error(s, m, "The provided object could not be expired from the cache\n");