mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Update xpath dependency (#507)
This commit is contained in:
6
vendor/github.com/antchfx/htmlquery/.travis.yml
generated
vendored
6
vendor/github.com/antchfx/htmlquery/.travis.yml
generated
vendored
@@ -1,9 +1,9 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.6
|
||||
- 1.7
|
||||
- 1.8
|
||||
- 1.9.x
|
||||
- 1.12.x
|
||||
- 1.13.x
|
||||
|
||||
install:
|
||||
- go get golang.org/x/net/html/charset
|
||||
|
||||
14
vendor/github.com/antchfx/htmlquery/README.md
generated
vendored
14
vendor/github.com/antchfx/htmlquery/README.md
generated
vendored
@@ -10,7 +10,7 @@ Overview
|
||||
|
||||
`htmlquery` is an XPath query package for HTML, lets you extract data or evaluate from HTML documents by an XPath expression.
|
||||
|
||||
`htmlquery` build-in the query object caching feature based on [LRU](https://godoc.org/github.com/golang/groupcache/lru), this feature will caching the recently used XPATH query string. enable caching can avoid re-compile XPath expression each query.
|
||||
`htmlquery` built-in the query object caching feature based on [LRU](https://godoc.org/github.com/golang/groupcache/lru), this feature will caching the recently used XPATH query string. Enable query caching can avoid re-compile XPath expression each query.
|
||||
|
||||
Installation
|
||||
====
|
||||
@@ -101,7 +101,17 @@ Yes, you can. We offer the `QuerySelector` and `QuerySelectorAll` methods, It wi
|
||||
|
||||
Cache a query expression object(or reused) will avoid re-compile XPath query expression, improve your query performance.
|
||||
|
||||
#### Disable caching feature
|
||||
#### XPath query object cache performance
|
||||
|
||||
```
|
||||
goos: windows
|
||||
goarch: amd64
|
||||
pkg: github.com/antchfx/htmlquery
|
||||
BenchmarkSelectorCache-4 20000000 55.2 ns/op
|
||||
BenchmarkDisableSelectorCache-4 500000 3162 ns/op
|
||||
```
|
||||
|
||||
#### How to disable caching?
|
||||
|
||||
```
|
||||
htmlquery.DisableSelectorCache = true
|
||||
|
||||
12
vendor/github.com/antchfx/htmlquery/cache.go
generated
vendored
12
vendor/github.com/antchfx/htmlquery/cache.go
generated
vendored
@@ -3,9 +3,8 @@ package htmlquery
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/golang/groupcache/lru"
|
||||
|
||||
"github.com/antchfx/xpath"
|
||||
"github.com/golang/groupcache/lru"
|
||||
)
|
||||
|
||||
// DisableSelectorCache will disable caching for the query selector if value is true.
|
||||
@@ -16,8 +15,9 @@ var DisableSelectorCache = false
|
||||
var SelectorCacheMaxEntries = 50
|
||||
|
||||
var (
|
||||
cacheOnce sync.Once
|
||||
cache *lru.Cache
|
||||
cacheOnce sync.Once
|
||||
cache *lru.Cache
|
||||
cacheMutex sync.Mutex
|
||||
)
|
||||
|
||||
func getQuery(expr string) (*xpath.Expr, error) {
|
||||
@@ -25,8 +25,10 @@ func getQuery(expr string) (*xpath.Expr, error) {
|
||||
return xpath.Compile(expr)
|
||||
}
|
||||
cacheOnce.Do(func() {
|
||||
cache = lru.New(50)
|
||||
cache = lru.New(SelectorCacheMaxEntries)
|
||||
})
|
||||
cacheMutex.Lock()
|
||||
defer cacheMutex.Unlock()
|
||||
if v, ok := cache.Get(expr); ok {
|
||||
return v.(*xpath.Expr), nil
|
||||
}
|
||||
|
||||
9
vendor/github.com/antchfx/htmlquery/go.mod
generated
vendored
Normal file
9
vendor/github.com/antchfx/htmlquery/go.mod
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
module github.com/antchfx/htmlquery
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/antchfx/xpath v1.1.6
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
|
||||
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd
|
||||
)
|
||||
11
vendor/github.com/antchfx/htmlquery/go.sum
generated
vendored
Normal file
11
vendor/github.com/antchfx/htmlquery/go.sum
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
github.com/antchfx/xpath v1.1.6 h1:6sVh6hB5T6phw1pFpHRQ+C4bd8sNI+O58flqtg7h0R0=
|
||||
github.com/antchfx/xpath v1.1.6/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd h1:QPwSajcTUrFriMF1nJ3XzgoqakqQEsnZf9LdXdi2nkI=
|
||||
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
Reference in New Issue
Block a user