mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-14 04:07:46 +00:00
* Add redis support for distributed caching * Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * ... and another all nighter. * fixup! ... and another all nighter. * fixup! fixup! ... and another all nighter. * fixup! fixup! fixup! ... and another all nighter. * Resolve issue #85 by adding ability to set custom claims in JWT tokens * Remove redundant validation in auth middleware ( issue #89 ) * Add ability to set cookie prefix for session cookies ( #87 ) * fixup! Add ability to set cookie prefix for session cookies ( #87 ) * Add ability to set cookie max age - issue #91 * Potential fix for code scanning alert no. 10: Size computation for allocation may overflow Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fixup! Merge main into 0.8.0-redis: resolve conflicts --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
43 lines
851 B
Go
43 lines
851 B
Go
package miniredis
|
|
|
|
import (
|
|
"github.com/alicebob/miniredis/v2/hyperloglog"
|
|
)
|
|
|
|
type hll struct {
|
|
inner *hyperloglog.Sketch
|
|
}
|
|
|
|
func newHll() *hll {
|
|
return &hll{
|
|
inner: hyperloglog.New14(),
|
|
}
|
|
}
|
|
|
|
// Add returns true if cardinality has been changed, or false otherwise.
|
|
func (h *hll) Add(item []byte) bool {
|
|
return h.inner.Insert(item)
|
|
}
|
|
|
|
// Count returns the estimation of a set cardinality.
|
|
func (h *hll) Count() int {
|
|
return int(h.inner.Estimate())
|
|
}
|
|
|
|
// Merge merges the other hll into original one (not making a copy but doing this in place).
|
|
func (h *hll) Merge(other *hll) {
|
|
_ = h.inner.Merge(other.inner)
|
|
}
|
|
|
|
// Bytes returns raw-bytes representation of hll data structure.
|
|
func (h *hll) Bytes() []byte {
|
|
dataBytes, _ := h.inner.MarshalBinary()
|
|
return dataBytes
|
|
}
|
|
|
|
func (h *hll) copy() *hll {
|
|
return &hll{
|
|
inner: h.inner.Clone(),
|
|
}
|
|
}
|