leonibr / community-extensions-cache-postgres

A PostgreSQL Implementation of IDistributedCache interface. Using Postgresql as distributed cache in Asp.Net Core. NetStandard 2.0
59 stars 17 forks source link

Allow expiration removal loop to be disabled #5

Closed dariogriffo closed 3 years ago

dariogriffo commented 3 years ago

Added a configuration option to disable the loop that removes expired items. By default it will run the loop. This is useful when multiple processes access the same database/schema/table, ie: a webapi and 2 background services use the same cache configuration, ideally the loop should execute only in one of them.

leonibr commented 3 years ago

Lets talk about this... I see your point but I think this control should be on the database so it could "cancel" deletion requests if time is less the minimum loop interval, what do you think @dariogriffo ?

dariogriffo commented 3 years ago

Lets talk about this... I see your point but I think this control should be on the database so it could "cancel" deletion requests if time is less the minimum loop interval, what do you think @dariogriffo ?

But how would that happen if they are 2 different applications. They have different memory space so they will be triggering the process independently. That's the scenario I want to cover here. For example the solution is 1 webapi and one background service communicating via a service bus. Both share the same models hence they want to share the cache, let's say to access a customer configuration. I know ideally they will need to setup a different schema/table in their apps, but what if they don't?