We are creating Sitecore Items in the Web database using the SC Item Web API.
However, they are not showing immediately in the content tree until we clear the cache.
Is there a way to exclude only certain items from being included in the SC database cache? If so, how do you do this?
Thanks
You could create a custom action to partially clear the cache as explained here :
The code from the link (written by Dave Peterson):
public static void ClearDataItemCache(Database database, IEnumerable ids)
{
Cache prefetchCache = GetPrefetchCache(database);
foreach (ID id in ids)
{
if (!ID.IsNullOrEmpty(id))
{
database.Caches.ItemCache.RemoveItem(id);
database.Caches.DataCache.RemoveItemInformation(id);
database.Caches.StandardValuesCache.RemoveKeysContaining(id.ToString());
if (prefetchCache != null)
{
prefetchCache.Remove(id);
}
}
}
}
However, do keep in mind that whenever you do a publish from the Master database to the Web database, your item will be removed again (unless it's also created in the Master database of course).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.