New returns a proxycache blob storage that reads from cache, then origin, populating cache as needed, up to a total of maxBytes.
(maxBytes int64, cache, origin blobserver.Storage)
| 72 | // New returns a proxycache blob storage that reads from cache, |
| 73 | // then origin, populating cache as needed, up to a total of maxBytes. |
| 74 | func New(maxBytes int64, cache, origin blobserver.Storage) *Storage { |
| 75 | sto := &Storage{ |
| 76 | origin: origin, |
| 77 | cache: cache, |
| 78 | lru: lru.NewUnlocked(0), |
| 79 | maxCacheBytes: maxBytes, |
| 80 | } |
| 81 | return sto |
| 82 | } |
| 83 | |
| 84 | func init() { |
| 85 | blobserver.RegisterStorageConstructor("proxycache", blobserver.StorageConstructor(newFromConfig)) |