mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 18:10:54 +00:00
make stmt cache smaller
This commit is contained in:
parent
8e37fe3b78
commit
1dffa20435
3
cache/redis/redis.go
vendored
3
cache/redis/redis.go
vendored
@ -38,8 +38,9 @@ import (
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/cache"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -1,8 +1,10 @@
|
||||
package param
|
||||
|
||||
import "testing"
|
||||
import "reflect"
|
||||
import "time"
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type testDefinition struct {
|
||||
strValue string
|
||||
|
@ -19,9 +19,10 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
)
|
||||
|
||||
func TestGetInt(t *testing.T) {
|
||||
|
@ -16,9 +16,9 @@ package logs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -18,10 +18,11 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
)
|
||||
|
||||
// DriverType database driver constant int.
|
||||
@ -459,7 +460,9 @@ func newStmtDecorator(sqlStmt *sql.Stmt) *stmtDecorator {
|
||||
}
|
||||
|
||||
func newStmtDecoratorLruWithEvict() *lru.Cache {
|
||||
cache, _ := lru.NewWithEvict(1000, func(key interface{}, value interface{}) {
|
||||
// temporarily solution
|
||||
// we fixed this problem in v2.x
|
||||
cache, _ := lru.NewWithEvict(50, func(key interface{}, value interface{}) {
|
||||
value.(*stmtDecorator).destroy()
|
||||
})
|
||||
return cache
|
||||
|
@ -40,10 +40,11 @@
|
||||
package authz
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/casbin/casbin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// NewAuthorizer returns the authorizer.
|
||||
|
@ -15,13 +15,14 @@
|
||||
package authz
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/plugins/auth"
|
||||
"github.com/casbin/casbin"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testRequest(t *testing.T, handler *beego.ControllerRegister, user string, path string, method string, code int) {
|
||||
|
@ -31,14 +31,16 @@
|
||||
//
|
||||
// more docs: http://beego.me/docs/module/session.md
|
||||
package redis_cluster
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
rediss "github.com/go-redis/redis"
|
||||
"time"
|
||||
)
|
||||
|
||||
var redispder = &Provider{}
|
||||
|
@ -33,13 +33,14 @@
|
||||
package redis_sentinel
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/go-redis/redis"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/session"
|
||||
"github.com/go-redis/redis"
|
||||
)
|
||||
|
||||
var redispder = &Provider{}
|
||||
|
@ -369,7 +369,6 @@ func TestFileSessionStore_SessionRelease(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
|
||||
s.Set(i, i)
|
||||
s.SessionRelease(nil)
|
||||
}
|
||||
|
@ -16,12 +16,13 @@ package beego
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/astaxie/beego/testdata"
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego/testdata"
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
)
|
||||
|
||||
var header = `{{define "header"}}
|
||||
|
3
testdata/bindata.go
vendored
3
testdata/bindata.go
vendored
@ -11,13 +11,14 @@ import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
)
|
||||
|
||||
func bindataRead(data []byte, name string) ([]byte, error) {
|
||||
|
@ -16,13 +16,14 @@ package validation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
|
||||
// CanSkipFuncs will skip valid if RequiredFirst is true and the struct field's value is empty
|
||||
|
Loading…
Reference in New Issue
Block a user