diff --git a/slasher/flags/flags.go b/slasher/flags/flags.go
index ef7a34fe708c..b188ce04d1bc 100644
--- a/slasher/flags/flags.go
+++ b/slasher/flags/flags.go
@@ -51,4 +51,10 @@ var (
 		Name:  "enable-historical-detection",
 		Usage: "Enables historical attestation detection for the slasher. Requires --historical-slasher-node on the beacon node.",
 	}
+	// SpanCacheSize is a flag that sets the size of span cache.
+	SpanCacheSize = &cli.IntFlag{
+		Name:  "spans-cache-size",
+		Usage: "Sets the span cache size.",
+		Value: 256,
+	}
 )
diff --git a/slasher/main.go b/slasher/main.go
index 21df6538cc2c..5de54f53ab02 100644
--- a/slasher/main.go
+++ b/slasher/main.go
@@ -69,6 +69,7 @@ var appFlags = []cli.Flag{
 	flags.BeaconCertFlag,
 	flags.BeaconRPCProviderFlag,
 	flags.EnableHistoricalDetectionFlag,
+	flags.SpanCacheSize,
 }
 
 func init() {
diff --git a/slasher/node/node.go b/slasher/node/node.go
index 1538055cf241..29fffdb6b43a 100644
--- a/slasher/node/node.go
+++ b/slasher/node/node.go
@@ -168,7 +168,9 @@ func (s *SlasherNode) startDB() error {
 	clearDB := s.cliCtx.Bool(cmd.ClearDB.Name)
 	forceClearDB := s.cliCtx.Bool(cmd.ForceClearDB.Name)
 	dbPath := path.Join(baseDir, slasherDBName)
-	cfg := &kv.Config{}
+	spanCacheSize := s.cliCtx.Int(flags.SpanCacheSize.Name)
+	cfg := &kv.Config{SpanCacheSize: spanCacheSize}
+	log.Infof("Span cache size has been set to: %d", spanCacheSize)
 	d, err := db.NewDB(dbPath, cfg)
 	if err != nil {
 		return err
diff --git a/slasher/usage.go b/slasher/usage.go
index 61fd21436ce1..f441dff59ff8 100644
--- a/slasher/usage.go
+++ b/slasher/usage.go
@@ -83,6 +83,7 @@ var appHelpFlagGroups = []flagGroup{
 			flags.RPCHost,
 			flags.BeaconRPCProviderFlag,
 			flags.EnableHistoricalDetectionFlag,
+			flags.SpanCacheSize,
 		},
 	},
 	{