storj/satellite/console/consoleweb/consoleql
Jessica Grebenschikov 4a2c66fa06 satellite/accounting: add cache for getting project storage and bw limits
This PR adds the following items:
1) an in-memory read-only cache thats stores project limit info for projectIDs

This cache is stored in-memory since this is expected to be a small amount of data. In this implementation we are only storing in the cache projects that have been accessed. Currently for the largest Satellite (eu-west) there is about 4500 total projects. So storing the storage limit (int64) and the bandwidth limit (int64), this would end up being about 200kb (including the 32 byte project ID) if all 4500 projectIDs were in the cache. So this all fits in memory for the time being. At some point it may not as usage grows, but that seems years out.

The cache is a read only cache. When requests come in to upload/download a file, we will read from the cache what the current limits are for that project. If the cache does not contain the projectID, it will get the info from the database (satellitedb project table), then add it to the cache.

The only time the values in the cache are modified is when either a) the project ID is not in the cache, or b) the item in the cache has expired (default 10mins), then the data gets refreshed out of the database. This occurs by default every 10 mins. This means that if we update the usage limits in the database, that change might not show up in the cache for 10 mins which mean it will not be reflected to limit end users uploading/downloading files for that time period..

Change-Id: I3fd7056cf963676009834fcbcf9c4a0922ca4a8f
2020-09-25 16:28:49 +00:00
..
testdata web/satellie: added missing alt attribute to img tags (#3172) 2019-10-04 16:22:26 +03:00
apikey.go all: add missing dots 2020-08-11 17:50:01 +03:00
mail.go all: add missing dots 2020-08-11 17:50:01 +03:00
mutation_test.go satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
mutation.go satellite/projects: initial update project name functionality implemented 2020-09-15 12:21:56 +03:00
project.go all: add missing dots 2020-08-11 17:50:01 +03:00
projectmember.go all: add missing dots 2020-08-11 17:50:01 +03:00
query_test.go satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
query.go all: add missing dots 2020-08-11 17:50:01 +03:00
reward.go all: add missing dots 2020-08-11 17:50:01 +03:00
schema.go all: fix dots 2020-07-16 14:58:28 +00:00
typecreator.go all: fix dots 2020-07-16 14:58:28 +00:00
user.go all: add missing dots 2020-08-11 17:50:01 +03:00
usercredit.go all: add missing dots 2020-08-11 17:50:01 +03:00