The size of the folder is unknown. It consists of all the files in it, so each file will be queried to find out its size, then all the sizes will be summed up and you will get the size of the folder.
It will take the same amount of time or more to save this information to the database, because when moving to the trash, several databases need to be updated - the used space and this new proposed one, the same will happen when deleting. I would suggest to enable a badger cache instead - it doesn’t require to implement another one metadata storage.
The slowest operation there is unlinking itself. Adding an additional cache would not help there too much. Especially when this cache already implemented and called a badger cache.
See