This is for a Blazor server app running on Azure. In the app there are a lot of times a user will be selecting a couple of tags from a very long list. The content of that list rarely changes and when it does, only this same app changes it so it can update the entry in the list at the same time.
This is like the tags here on Stack Overflow. The entire list is queried so often, you want a global List<Tag>
in memory.
Which brings up two questions. The first is these tags will generally be passed to DxTagBox. While a page is being edited by the user, and DxTagBox is applying filters to that list to determine what to show, it can be changed (Create/Update only - no Deletes).
I've got a question in to DevEx, but assuming DxTagBox wants an immutable list, what's the best approach? The best I've come up with is I have a static list and a live list. The static list is passed to DxTagBox and the live list is updated. Every N minutes I copy the live list to the static list for any future needs and let garbage collection determine when to free up the now orphaned list. I'm not wild on this approach, but it's the best I've come up with.
The second question is: How do I copy changes between servers when I have multiple servers? Would Redis work well here? Should I broadcast messages to all the other servers with each CRUD action? Should I just re-read everything from the database every N minutes?
Update: Yes, DxTagBox wants a complete immutable list.
My take on this is:
record
not a class
.IEnumerable
s against the singleton list and only materialize them when you consume them (in the DXTagBox). Don't create intermediate lists.