Developing NopCommerce Cache Challenge

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Good afternoon,

I am developing Nop Commerce applications but my development speed is really bad because every time I make a change I need to rebuild the application so it copies the files to the correct folder outputs and the cache starts from 0.

I tried to use Redis Cache but still the Cache is reseted everytime I rebuild the application which is pretty much always. Why?

Can someone explain me a away to improve this? I really love this project and I dont want to stop developing for it.

I would really appreciate your help/feedback.

Thanks
6 years ago
Can anyone help me with this? Do you guys dont have the same problem as me?

Thanks
6 years ago
Mine takes a while to build now also. I don't have any suggestions.
6 years ago
clears the cache for what exactly?

why do people post such ambiguous and unclear questions on the nopCommerce boards
6 years ago
I thought he was asking why the builds took a bit to compile. Seems each time I compile a plug in it does all the nop files. But I could be wrong. Lol
6 years ago
timmit wrote:
clears the cache for what exactly?

why do people post such ambiguous and unclear questions on the nopCommerce boards


NopCommerce uses MemoryCache by default.

Every time you rebuild the solution in Visual  Studio and run it again pressing F5 the CACHE is EMPTY.

This means that every time I run the application it takes loads of times to load because it needs to recache everything. This process slows down my development.

I would expect that every time I rebuild the application it would use the items previouslycached in memory.
6 years ago
Anyone know how can I improve my development speed ?

My application has 40k products so if every time I debug the application it needs to build the Cache from scratch it's very slow. Can we save the cache in SQL or something so it uses the exiting cache and it does not rebuild it all always ?

This is only a problem for Development. In Production obviously if we don't recycle the App Pool it will not clean the cache.

Thanks
6 years ago
I believe it should be fairly easy, just implement IStaticCacheManager with something of your choice and implement an IDependencyRegistrar along with your new type as an Autofac RegisterType.

NopEngine will iterate all implementations of IDependencyRegistrar.

I've never used NopCommerce but just looked at the code and it seems quite modular.

Errata:

I'm not sure what will happen in Autofac if an there exists many implementations of the same type. I know what happens in Structuremap :)

So maybe...
Due to Autofac you have to change:
if (config.RedisCachingEnabled)
            {
                builder..RegisterType<RedisConnectionWrapper>().As<IRedisConnectionWrapper>().SingleInstance();
                builder.RegisterType<RedisCacheManager>().As<IStaticCacheManager>().InstancePerLifetimeScope();
            }
            else
                builder.RegisterType<MemoryCacheManager>().As<IStaticCacheManager>().SingleInstance();

into something of your code.

But my advice is just to try it and see if Autofac serves the correct type.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.