From 779e0831984b8ecd9d78da43f3cb619b3105af62 Mon Sep 17 00:00:00 2001 From: Oliver Beattie Date: Fri, 6 Feb 2015 13:32:15 +0000 Subject: [PATCH] Use constant for default max prepared statements --- cluster.go | 4 +++- conn.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cluster.go b/cluster.go index 42bc2d111..6cfc1b59d 100644 --- a/cluster.go +++ b/cluster.go @@ -12,6 +12,8 @@ import ( "github.com/golang/groupcache/lru" ) +const defaultMaxPreparedStmts = 1000 + //Package global reference to Prepared Statements LRU var stmtsLRU preparedLRU @@ -86,7 +88,7 @@ func NewCluster(hosts ...string) *ClusterConfig { Consistency: Quorum, ConnPoolType: NewSimplePool, DiscoverHosts: false, - MaxPreparedStmts: 1000, + MaxPreparedStmts: defaultMaxPreparedStmts, } return cfg } diff --git a/conn.go b/conn.go index 142f11800..0f68fbe20 100644 --- a/conn.go +++ b/conn.go @@ -366,7 +366,7 @@ func (c *Conn) ping() error { func (c *Conn) prepareStatement(stmt string, trace Tracer) (*QueryInfo, error) { stmtsLRU.Lock() if stmtsLRU.lru == nil { - initStmtsLRU(1000) + initStmtsLRU(defaultMaxPreparedStmts) } stmtCacheKey := c.addr + c.currentKeyspace + stmt