You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's keep the call to ClearExpiredCache() in the initEncryptedTunnel() function if we can make it dynamic?
func ClearExpiredCache() { // should pass in a dynamic URL?
// open the cache
db := OpenDB(INDEXEDDB_CACHE, js.ValueOf(nil)) // Gets all layer8 caches for all URL
db.Set("onsuccess", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
tx := args[0].Get("target").Get("result").Call("transaction", "static", "readwrite") // create a tx
store := tx.Call("objectStore", "static") // get the object store called static
index := store.Call("index", "_exp") // get the index "_exp"
// get all the expired items
bound := js.Global().Get("IDBKeyRange").Call("upperBound", js.ValueOf(time.Now().Unix())) // create an upper bound
index.Call("openCursor", bound).Set("onsuccess", js.FuncOf(func(this js.Value, args []js.Value) interface{} { // user that upper bound to get the correct subset of data
cursor := args[0].Get("target").Get("result")
if cursor.IsUndefined() || cursor.IsNull() {
return nil
}
store.Call("delete", cursor.Get("value").Get("url")) // get the value of whatever is store in the KEYPATH "url" and delete it
cursor.Call("continue") // advance the cursor
return nil
}))
return nil
}))
}
The text was updated successfully, but these errors were encountered:
Let's keep the call to ClearExpiredCache() in the initEncryptedTunnel() function if we can make it dynamic?
The text was updated successfully, but these errors were encountered: