Best way to get thousands of accessories, without maintaining best performance

Here’s how I currently cache thousands of Ids. I generated these a few months back, however, these get outdated quickly, and I can’t do further things, like add a search for items/etc. in my avatar editor.
image
image
So Im wanting a way where I can auto generate say once a week automatically in game, that generates the most favorited/best selling items in the catalog for that week, and would mean every single player in every server views the exact same set of items.

This was the code I used to generate the list and manually copy/paste the outputted Ids to the code.

local CYCLES = 25

local AvatarEditorService = game:GetService("AvatarEditorService")

local function GenerateItems(assetType)
	local Params = CatalogSearchParams.new()
	Params.AssetTypes = { assetType }
	Params.SortType = Enum.CatalogSortType.MostFavorited
	Params.IncludeOffSale = true

	local CatalogPages = AvatarEditorService:SearchCatalog(Params)

	local ItemIds = {}
	local Pages = 0

	while Pages < CYCLES do
		local CurrentPage = CatalogPages:GetCurrentPage()
		for _, itemInfo in CurrentPage do
			table.insert(ItemIds, itemInfo.Id)
		end

		if CatalogPages.IsFinished then
			break
		end

		CatalogPages:AdvanceToNextPageAsync()
		Pages += 1

		task.wait()
	end

	print(ItemIds)
end

As stated above, I want a way that’d automate this fully, maybe using data stores/memory store to keep everything easy. Unsure how I’d organize across clients and again, how I can do a search system for players to enter a keyword, say “blue” and it’d bring up any blue based items, cause atm, all I have is the ids, and Id have to get info for hundreds of items, in seconds. I want the search to be instant

You should first start by calculating which week you are currently on by using some starting time.
This way, you will be able to determine when a new week has begun.

During each week, when an item is purchased, you should store every purchased item to a global datastore (maybe title the accessed key according to the week)

When a new week begins, grab all purchased ids from the previous week and combine all of the same ids into a summation table and then you can find the highest values amongst these.

This way, you can then identify the best selling items of the week.