Skip to content

Commit

Permalink
Use constant for default max prepared statements
Browse files Browse the repository at this point in the history
  • Loading branch information
obeattie committed Feb 6, 2015
1 parent 241b2b9 commit 779e083
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"github.com/golang/groupcache/lru"
)

const defaultMaxPreparedStmts = 1000

//Package global reference to Prepared Statements LRU
var stmtsLRU preparedLRU

Expand Down Expand Up @@ -86,7 +88,7 @@ func NewCluster(hosts ...string) *ClusterConfig {
Consistency: Quorum,
ConnPoolType: NewSimplePool,
DiscoverHosts: false,
MaxPreparedStmts: 1000,
MaxPreparedStmts: defaultMaxPreparedStmts,
}
return cfg
}
Expand Down
2 changes: 1 addition & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 779e083

Please sign in to comment.