You can do this by making sure that your renderings are set to Vary by User. This adds the user to the cacheKey string like this "_#user:" + Context.GetUserName();
You can then use the following code to clear the html cache for that user:
// Need to clear the cache for the header and the user profile....
var htmlCache = CacheManager.GetHtmlCache(Context....
You can turn cache off at the site level in the site definition in configuration:
<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="...
Other option is to delete from time to time media cache using an schedule agent. Current value is 24 days but if you need to clear more ofen just decrease max age parameter of the last setting (see below settings). It is not recommended to clear media cache very often because you will have some performance impact.
It could be that you just have a dodgy rendering that is running on every page and is then cached for that page; to see if this is the case you can profile Sitecore pages.
You can investigate this by clicking on the "Debug" option
and scrolling to the bottom of the page to see the speed of renderings:
From here you can either optimise the code, or check ...
I typically disable caching for my local environment by setting the HTML cache lifetime to 1 second using the following config patch:
To make this specific to your local environment, you can patch it in using a configuration ...
It is completely safe to just delete the folder /App_data/MediaCache without causing disruption. The minute an image gets called up again, it will be cached again, so no worries about the functionality of your website. We make sure it get's cleaned up every week.
In addition you can set up a clean up job to do the work for you. Unfortunately the usage of /...
I would use a remote event that can be raised on the CM server and subscribed to by the CD servers. When the event is raised, an event handler can execute on the CD servers clearing the cache.
This is the mechanism used by the HtmlCacheClearer handler that comes with Sitecore, you can see how it is setup in the default Sitecore.config:
Just for clarification of how HTML cache works, the remote CD servers need to know about the CM server publish event. That setting is EnableEventQueues. If it is set to true on the remote server, the remote listen for the CM end:publish event.
<setting name="EnableEventQueues" value="true"/>
Then on the CM server you need to make sure the publish:...
This is item data pulled out from the database when the site starts up - from the Sitecore docs:
"Each database prefetch cache entry represents an item in a database. Database prefetch cache
entries include all field values for all versions of that item, and information about the parent and
children of the item.
Populating the prefetch ...
Yes, use the glassCache attribute. A value of anything other than false means the cache will be enabled for that site:
Vary By options each serve different use cases, and are not always applicable when caching a rendering.
If a component doesn't have a data source then Vary By Data will cache its output by the Context Item. This would cause a cached instance of this component for every page.
If a component outputs the same markup everywhere, then you don't want to apply ...
Possible answers to 1,2,3...
Sounds like you need to do a bit of tuning on your caches. Sitecore has a number of "admin" pages which help you diagnose problems such as this - you can use the cache admin page to monitor the current size, configured size and vectors of the individual caches, include prefetch. To access this page, browse to http:///sitecore/...
The DefaultScavengeStrategy is responsible for scavenging (freeing up) memory from your caches when your application is maxing out on its memory resources, as determined by the configured cache size limits. The warning that you are seeing indicates that memory usage was maxing out for the specified cache, based on your configured maximum cache sizes, and so ...
I typically do what you're doing and set all the renderings I want cached to be cacheable. However, for my local development, I will set cacheHtml to false on the site definition.
<site name="mySite" patch:before="site[@name='website']"
You can remove access to /sitecore/templates/System/Layout/Rendering Parameters/Standard Rendering Parameters/Caching
Navigate to the item
Open Security tab
Click on Assign button
In the dialog which will appear select user or group (preferably) from whom you would like to hide the section
Remove the inheritance for the item and its descendats
Adding to @Gatogordo's answer, you may have a site configuration which includes the HtmlCacheClearer instead, such as:
<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
Do we need to include both master and web db settings in CMS? Or just master settings in CMS.
Only the master db will suffice. Web db items are only used when the site is accessed through the front-end which is usually not the case on CMS.
Do we need to include master and web db settings in CD? Or just Web settings in CD.
Only the web db. The master db is ...
Sitecore comes with out of the box possibilities to configure media caching.
Have a look at the Sitecore.config:
<!-- MEDIA RESPONSE - CACHEABILITY
The <see cref="HttpCacheability">cacheability</see> to use in media response headers.
Possible values: NoCache, Private, Public, Server, ServerAndNoCache, ServerAndPrivate
If you are using Sitecore 8.0 Update 3 upwards then a couple of new default processors were added to the Health Monitors to periodically dump the Cache Status and Rendering Statistics to files on disk. By default this process is run every 10 minutes, and they are run on the CD servers as well so you can use these files to check how your caches have been ...
The question is quite broad and there are many ways you can achieve this obviously (you mentioned sitecore query and foreach loop).
Another option would be to use the sitecore content search (with rendering cache on top, of course).
So, you can define your custom POCO object with IsInFooter and IsInHeader fields and query your index.
Simplified code (...
If Cachable attribute equals true, it means that Glass Mapper will apply cache for this object. I've decompiled the Glass.Mapper.Sc.dll, where CacheKeyGenerator is defined and we can see that it doesn't consider the language in the key for cache:
public class CacheKeyGenerator : ICacheKeyGenerator
public string ...
If you do not want to disable cache size limits (which in our situation can cause memory issues when building large indexes on Azure WebApps), you can use the following Sitecore setting to change the "web[isLanguageFallbackValid]" and "master[isLanguageFallbackValid]" sizes:
<setting name="Caching.SmallCacheSize" ...
I would recommend solving this by embracing HTTP caching by changing the Cache-Control to no-cache. The browser will then always check to see if there's a newer/different version but since media items have Etag headers, the browser won't download the data it again if it's the same version it has cached.
As for implementation, you can apply this to all ...
You have it right, the Page refers to the fully rendered HTML Markup of the page. This would include all renderings on that page that are not ajax'd in after the page load in the browser.
Rather than disable the HTML cache for that page, why not use the Vary by Query String option on your query-string-dependent renderings? I wrote an article that should help get you started, but the below should cover the basic overview of what you would be doing.
The 'Vary by' Cache Options
Sitecore includes support for varying HTML Cached copies of a ...
The cache is typically cleared when publishing, which would happen frequent enough for you to not enable this agent.
Imagine a case where you don't want the cache to be cleared, perhaps due to the fact there is a ton of content getting published and you don't want it to refresh every single time an item changes. You could then use this to refresh it once a ...
Option #3 actually does work. I forgot to do a hard refresh in my browser during testing. Oops.
So you can add this to your main web.config
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365....
If you are referring to HTML Cache, by default, Sitecore includes cache-clearing event handlers that clear the HTML cache when the publish:end and publish:end:remote events are raised. The handler is typed to the Sitecore.Publishing.HtmlCacheClearer class and calls the ClearCache method.
You can find the subscriptions for these events in your ShowConfig (/...
Adding a unique URL parameter will force the browser to request the updated image, as mentioned by both the other answers. You'll also face this same issue if you are using a CDN by the way and using the same technique works well in this situation too. I provided code for an updated MediaProvider in my post about CDNs. This will ensure you don't need to ...
Make sure to check "publish subitems" when publishing parent folder.
To verify if the item was removed from the web database, switch to web database from Sitecore Desktop and see if your page is there. Open .../sitecore/shell/ in the browser and on the bottom right corner of the screen there is a button to switch database. Switch back to master database ...