Hi,
Unfornately, I don't think it's a good idea to clear cache of a product only. The CatalogCache is used for CatalogEntryDto, but due to Dto nature, an Entry can be cached in multiple CatalogEntryDtos. We did some profiling and see that clean the entire CatalogCache can be faster than using RemoveByPattern to clear a specific cache correctly.
The good news is we are working on this to make the cache more efficient. Stay tuned :)
Regards.
/Q
Thanks Quan, I need some help here.
Looooooong Story short, background of problem is that
In an Windows Sevice (Integration application) develoers are processing XML
and Save entries using CatalogSystem e.g. this.catalogSystem.SaveCatalogEntry(entryDto);
Those updated changes will not appear in Online Center Commerce section
Work arround written for that was after saving entry by catalog system they have written a service to notify change to website
That does following stuff
CacheHelper.Clear(string.Empty);
var productLink = referenceConvertor.GetContentLink(productCode, CatalogContentType.CatalogEntry);
var product = (ProductContent)contentLoader.Get<ProductContent>(productLink).CreateWritableClone();
var productSaveAction = product.LoadEntry().IsActive ? SaveAction.Publish: SaveAction.Reject;
contentRepository.Save(product, productSaveAction, AccessLevel.NoAccess);
They used CacheHelper.Clear(string.Empty) method that clears the whole site cache and if we got 1000s item in one feed it is clearing cache every time and in result it effect the live site very badly. In result as long as integration application is running site remains near about unresponsive.
Without clearing cache it doesnot save/publish latest changes.
waiting for your advice/help on this.
Regards
/K
When you call this:
contentRepository.Save(product, productSaveAction, AccessLevel.NoAccess);
CatalogCache should be cleared already. CacheHelper.Clear(string.Empty) will clear entire HttpContext.Current.Cache or HttpRuntime.Cache, so yes, it's very ineffficient.
What is your "Online Center Commerce section"? You mean Catalog UI?
I think the better solution is to make sure your Windows Service to have proper event handling. I think your service is missing event configuration so it can't raise event to let the website knows there's change. If it's configured correctly then we do the synchronization just fine :)
Configurations can be found in <system.serviceModel> section of web.config.
Regards.
/Q
Well, Correct me If I am wrong
If I Set up below settings in my Windows Service
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/75/Event-management/WCF-event-management/
then I wouln't need to publish as we are doing at this stage.
Correct?
Regards
/K
Yes, if the event system is working then after you saving an entry, it should appear in any where, both in Commerce Manager and in Catalog UI without additional steps.
Regards.
/Q
I am using same settings in
Front Website
Commerce Manager Site
Windows Client
<system.serviceModel>
<extensions>
<bindingElementExtensions>
<add name="udpTransportCustom" type="Microsoft.ServiceModel.Samples.UdpTransportElement, EPiServer.Events" />
</bindingElementExtensions>
</extensions>
<services>
<service name="EPiServer.Events.Remote.EventReplication" behaviorConfiguration="DebugServiceBehaviour">
<!--<endpoint name="RemoteEventServiceEndPoint" contract="EPiServer.Events.ServiceModel.IEventReplication" bindingConfiguration="RemoteEventsBinding" address="net.tcp://localhost:13000/RemoteEventService" binding="netTcpBinding"/>-->
<endpoint name="RemoteEventServiceEndPoint" contract="EPiServer.Events.ServiceModel.IEventReplication" binding="customBinding" bindingConfiguration="RemoteEventsBinding" address="soap.udp://239.255.255.19:5000/RemoteEventService" />
</service>
</services>
<client>
<!-- Uncomment this endpoint and the "RemoteEventServiceEndPoint" to enable remote events -->
<endpoint name="RemoteEventServiceClientEndPoint" address="soap.udp://239.255.255.19:5000/RemoteEventService" binding="customBinding" bindingConfiguration="RemoteEventsBinding" contract="EPiServer.Events.ServiceModel.IEventReplication" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="DebugServiceBehaviour">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="EPiServer.Business.Commerce.EventServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="CommerceSiteBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EventServiceEndpointBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="RemoteEventsBinding">
<binaryMessageEncoding />
<udpTransportCustom multicast="True" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>
With changes in windows client, I can see the updates in Commerce Manager through catlog Management
Press F5, changes are not visible in Online center Catalog UI.
If I Save that product from Commerce Manager, Changes are visible in Catalog UI
Didn't worked. Any idea?
It looks like your service is also missing the configuration for Framework, it should have something like this:
<episerver.framework>
<scanAssembly forceBinFolderScan="true" />
<appData basePath="appData" />
</episerver.framework>
This allows Framework to scan the assembly and register types related to event system.
Regards.
/Q
Didn't work. can I forward you app.config on your email (i have your email address).
Regards
/K
Sure :)
I will try to take a look when I have time. But if I can't resolve it in a reasonable timeframe you will need to contact our developer support service.
Regards.
/Q
for updates...
I couldn't manage catalog events yet but mean while i found this interesting thing
DataFactoryCache.RemovePage(productLink);
DataFactoryCache.RemoveListing(productLink);
It is clearing cache for a particular product/variant, I am wondering in there any catalyst you are aware of if i use this function.
Regards
Khurram
If you enable debug output for EPiServer.Events in the site, can you see that it is actually receiving the cache invalidation event? Also, I am not really familiar with UDP-configured remote events, but as for TCP the config shouldn't be the same in all sites. Depending on who's broadcasting and who's listening the configs differ.
(UDP)Receiving is OK but Broadcasting from Integration application is an issue.
Regards
/K
With commerce 8.9 you have new possibilities to work with cache dependencies for this: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Commerce/8/Caching/Caching/
Hi,
EPiServer Comere 8.6.1
I want a function that could Clear the cache (properties, idealy pricing also) of a product without effecting the rest of the site. Any Help
I am happy if it clear the local cache only in load balancing also.
My code will be something like
ClearProductContentCache(strin product code){
//Clear Cache
******************
CacheHelper.RemoveByPattern("?????");
******************
}
Regards
/K