I need to track user actions, for example video view count. Then the data is used to get most popular videos for last 7 days, 30 days and for a year. For this purpose I have created a Downloads table with timestamp
and video
fields.
Each time user opens the catalog, I'm running queries to get Downloads and sort the videos based on them. This is a working, but not the efficient solution. A good option is to add aggregated data table storing summary counts for the popular queries - countFor7Days
, etc. This will improve query performance. But it requires a job that would update the aggregate table every day.
The question is how to implement this job in CloudKit? Is there are such built-in feature, or I need a custom service running somewhere?