Try our conversational search powered by Generative AI!

Load Order Without Cache



We have a process that changes the order data via a stored procedure. The issue we are running into is that when we then load up the order via the order repository, the order is pulling from a cached version that does not have the changes the store procecure executed. Through my research, I havent found a way yet to load up the order fresh and not from cache. Is there a way to do this?

Thank you.

Apr 24, 2018 21:34

We advise against such direct data manupulation. Is there any reason you can't use the APIs to update the order?

Technically you can remove the cache before loading the order, but that would be expensive.

Edited, Apr 24, 2018 21:57

There is a complicated process that integrates with a 3rd party outside epi that we cant change. We usually try to avoid direct manipulation, but was not an option in this case.

I am assuming removing the cache would effect everything and not just the one order?

Apr 24, 2018 22:03

Basically yes. We don't disclose how is the cache key is constructed (it's internal implementation), and there might be more than 1. So to be "safe" you would need to clear the cache, and that'd be expensive.

Is it possible to share which data are you updating? I don't think that can't be done via APIs which adequate performance. 

Apr 24, 2018 22:12

We are updating data on order group and purchase order. We have a workaround in place now that seems to work without having to clear cache.

Thanks for your help.

Apr 24, 2018 22:18

Hallo ,

I have the same problem . I am saving my cart from orderrepository but it is reflected after Irestart my solution.

I can't fetch the updated repository.

_wishlist.Name = "wishList";
DateTime today = DateTime.Today;
Cart.Properties["DeliveryDate"] = today;
Cart.Properties["DeliveryTime"] = DateTime.Now.ToString("HH:mm");
var result = _orderRepository.Save(Cart);

//saves my current cart as wishlist

 var wishlistsOrders = _orderRepository.Load(_customerContext.CurrentContactId, string.Empty)

//loads my wishlists but doesn't lods the one just updated above.

//loads it after I have restarted the solution.

Any input will be great help.

Sep 05, 2018 15:31

Himshikhar Verma How do you load your Cart at the first place? 

Edited, Sep 05, 2018 15:34

private ICart Cart
get { return _wishlist ?? (_wishlist = _cartService.LoadCart(_cartService.DefaultCartName)); }

//this loads my current cart.

Sep 05, 2018 15:43

Hmm, I think there is a bug in our side, I'll file a bug for it.

In the meanwhile, what you can do is to load the wishlist by  

 _orderRepository.Load(_customerContext.CurrentContactId, _cartService.DefaultCartName);


I'm not sure why you are using "DefaultCartName" for wishlist, but that's your decision 

Sep 05, 2018 15:51

Actually we already had the bug COM-6485, which was fixed and released in Commerce 11.8.2

Your best option should be upgrade to latest version (well, you can upgrade to that exact version, but newer version is better) 

Sep 05, 2018 15:55

Actually..we are using "Default" as cart and we are saving a cart as our wishlist by updating the name of our cart.

if (Cart == null)
_wishlist = _cartService.LoadOrCreateCart(_cartService.DefaultCartName);
_wishlist.Name = "wishList"; // cart name updated here
DateTime today = DateTime.Today;
Cart.Properties["DeliveryDate"] = today;
Cart.Properties["DeliveryTime"] = DateTime.Now.ToString("HH:mm");
var result = _orderRepository.Save(Cart);

In this way we moved cart with name "Default" to wishlist named as "Wishlist" in the orderrepository.

But when I tried to load the all saved wishlist I can fetch it using..

var wishlistsOrders = _orderRepository.Load(_customerContext.CurrentContactId, string.Empty);

But above code does not returns me the cart we saved as "wishlist".

it return all the objects in "wishlistsOrders " as"Default".

In this way we are not able to display the updated wishlist at current time becoz we can anly display cart with name as "wishlist".

Edited, Sep 05, 2018 16:02

I am using 11.6 

Sep 05, 2018 16:11

Thanks Quan.

Sep 05, 2018 16:32

How can I avoid the cache as when I save my cart or delete it in repository.

Is there any workaround which I can use to avoid loading my updated repository from cache?.

It will be a great input.


Sep 06, 2018 10:28

Upgrading to 11.8.2 should be much easier solution than having to work around the cache system (which is, pretty internal, and should not be touched ) 

Sep 06, 2018 10:35

hello ,

When I tried updating Eoiserver commerce , I had below exception.

While loading .NET types from "EPiServer.Commerce.UI.CustomerService" the following error(s) was reported (limited to first 10 errors):

    - System.IO.FileLoadException: Could not load file or assembly 'EPiServer.Shell, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'EPiServer.Shell, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'

=== Pre-bind state information ===
LOG: DisplayName = EPiServer.Shell, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
LOG: Appbase = file:///C:/Users/Himshikhar/source/repos/
LOG: Initial PrivatePath = C:\Users\Himshikhar\source\repos\\Sources\EPiServer.Reference.Commerce.Site\bin
Calling assembly : EPiServer.Commerce.UI.CustomerService, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7.

Solved many dependencies exceptions but didn't found a way to resolve this.

Nov 07, 2018 15:06

This should be in new thread instead. Which is the version of EPiServer.Shell in bin folder?

Nov 07, 2018 15:16


Nov 07, 2018 15:24

Isn't that self-explanatory? EPiServer.Commerce.UI.CustomerService, Version= requires at least EPiServer.Shell 11.7. When you upgrade Commerce it should also update other dependencies.

Nov 07, 2018 15:26

yes, but the thing is we didnt updated any of the dlls to 12.11 and there are many other dlls who want to execute 11.2

Nov 07, 2018 15:28

Then why do you have  EPiServer.Commerce.UI.CustomerService, Version= in your bin folder?

Nov 07, 2018 15:29

Not sure though , how i have 12.11 as  EPiServer.Commerce.UI.CustomerService in my bin.

Nov 07, 2018 15:37

That is something I am trying to figure out.

Nov 07, 2018 15:38

Check all references and make sure the dll is deleted from bin? 

Nov 07, 2018 15:40

Thanks Quan !!

I deleted bin folder and updated the database and it worked.

Edited, Nov 08, 2018 9:58

Hello ,

We successfuly updated the version to 11.8.2 but the problem still persists.

Nov 08, 2018 12:20

that's odd. I would suggest to contact developer support for further assistance. Based on the information you provided, then the bug fix in that version should have fixed it (you should probably upgrade to 11.8.5 which is the last version of 11.x anyway), so there might be something that was not mentioned/discovered 

Nov 08, 2018 12:45

Hi Quan

I'm working with Epi Commerce 12+, and am running into a similar caching issue described above. Here's my scenario :

There is an approval process involved in our order processing system, where the cart should not be converted into a purchase order until its finally approved. But once a user had submitted one cart for approval, they should be able to create another cart, while the first is still pending. Now, i know Episerver does not allow multiple carts per user, but I read in another of your posts, where this can be achived by having a different cart name. So, i'm using that approach and when a cart is submitted for approval, I modify the cart name by appending some value to it. This works fine and saves correctly and I can see changes in commerce manager. However, the user still sees the last submitted cart as his active shopping cart, even though i have checks in place to look for cart name and other fields, when loading active cart. When i debugged this part, it seems like its loading from cache as same order group id that I just updated name on, shows as original name. If I clear browser cache or recycle app pool, I no longer see an active shopping cart and can create again.

Is there a way to remove just this specific cache object? Or can you recommend an alternate approach to deal with this?


Mar 06, 2019 19:47

I'd suggest to create another thread. But as you already posted in this thread, here it goes

How does you load the cart? 

Mar 07, 2019 8:12

Hey Quan

I load cart by name, and then do additional checks on status, to see if i got the right cart. In this particular scenario, when I submit first cart, i change name to default name + id. Then once the page posts back, it tries to load active shopping cart, at which point I call Load cart by default name. This technically should return null, as i already updated name on existing cart, but since this stuff is cached and cache is not cleaned when cart name is changed, it loads the first cart, even though the name doesn't match.

Mar 07, 2019 15:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.