Skip to content

Commit efc7a7c

Browse files
author
bloom
committed
server: reduce size of in-memory caches
1 parent c8716fc commit efc7a7c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pkg/services/certmanager/certmanager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func NewCertManager(ctx context.Context, db db.DB, kms *kms.Kms,
5757
autocertDomains.Insert(httpConfig.WebsitesRootDomain)
5858

5959
certsCache := memorycache.New(
60-
memorycache.WithCapacity[string, *tls.Certificate](10_000),
60+
memorycache.WithCapacity[string, *tls.Certificate](1_000),
6161
memorycache.WithTTL[string, *tls.Certificate](1*time.Hour),
6262
)
6363

pkg/services/site/service/service.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,38 +123,38 @@ func NewSiteService(conf config.Config, db db.DB, queue queue.Queue, mailer mail
123123

124124
pagesHtmlCache := memorycache.New(
125125
memorycache.WithTTL[string, []byte](48*time.Hour),
126-
memorycache.WithCapacity[string, []byte](20_000),
126+
memorycache.WithCapacity[string, []byte](1_000),
127127
memorycache.WithInsertHook(zstdCompressInsertHook),
128128
memorycache.WithGetHook(zstdDecompressGetHook),
129129
)
130130

131131
assetsCache := memorycache.New(
132132
memorycache.WithTTL[string, []byte](48*time.Hour),
133-
memorycache.WithCapacity[string, []byte](500),
133+
memorycache.WithCapacity[string, []byte](50),
134134
)
135135

136136
pagesBodyHtmlCache := memorycache.New(
137137
memorycache.WithTTL[string, []byte](48*time.Hour),
138-
memorycache.WithCapacity[string, []byte](20_000),
138+
memorycache.WithCapacity[string, []byte](1_000),
139139
memorycache.WithInsertHook(zstdCompressInsertHook),
140140
memorycache.WithGetHook(zstdDecompressGetHook),
141141
)
142142

143143
pagesCache := memorycache.New(
144144
memorycache.WithTTL[string, site.Page](48*time.Hour),
145-
memorycache.WithCapacity[string, site.Page](20_000),
145+
memorycache.WithCapacity[string, site.Page](1_000),
146146
)
147147

148148
feedsCache := memorycache.New(
149149
memorycache.WithTTL[string, []byte](48*time.Hour),
150-
memorycache.WithCapacity[string, []byte](20_000),
150+
memorycache.WithCapacity[string, []byte](1_000),
151151
memorycache.WithInsertHook(zstdCompressInsertHook),
152152
memorycache.WithGetHook(zstdDecompressGetHook),
153153
)
154154

155155
sitemapsCache := memorycache.New(
156156
memorycache.WithTTL[string, []byte](48*time.Hour),
157-
memorycache.WithCapacity[string, []byte](20_000),
157+
memorycache.WithCapacity[string, []byte](1_000),
158158
memorycache.WithInsertHook(zstdCompressInsertHook),
159159
memorycache.WithGetHook(zstdDecompressGetHook),
160160
)

0 commit comments

Comments
 (0)