takttusur / takt-media

Check our news and participate to competitions and other events
MIT License
0 stars 0 forks source link

Caching chunks of Public Events #13

Open andreygolubkow opened 7 months ago

andreygolubkow commented 7 months ago

Caching chunks of Public Events

To provide fast response for public events request, we have to cache parsed events

Related with #5

Acceptance criteria

  1. Events are stored in Redis DB
  2. The key of event is PublicEvent:YYYYMMDD, where YYYY - year, MM - month, DD - day
    1. One key can contain several events, if events will be in one day
  3. Events should be loaded from VK.COM:
    1. Update interval should be set in appsettings.json
    2. The source of events(list of vk groups) should be set in appsettings.json
    3. If one source in unavailable, it should not affect to other sources

Points to discuss

_1. We want to see latest events and upcoming events on one page, how we can load it ? loading by months

  1. If we're using a tree to store events, what will be root ? n/a
  2. What will be in one slice ? How we can make it based on tree ? One chunk - one month ? +
  3. If we'll cache events today, but user'll request it tomorrow, which chunk should be loaded ? for current month_

Because, we don't have a lot of events, we can store it using date as a hash. The key will follow this pattern: PublicEvent:YYYYMMDD, which is a pointer to list of public events, which will be started at YYYYMMDD ( YYYY year, MM month, DD day) UTC time

But, we need to provide opportunity to load data for several days (interaval), from date to date. To reach that, the backed should make several requests to the cache and apply UNION operator for all results, to make one collection of events.