Lines Matching defs:cache

24  * Implements a cache backing store compatible with netscape cookies.txt format
55 #include "private-lib-misc-cache-ttl.h"
68 typedef int (*nsc_cb_t)(lws_cache_nscookiejar_t *cache, void *opaque, int flags,
75 nsc_backing_open_lock(lws_cache_nscookiejar_t *cache, int mode, const char *par)
84 cache->cache.info.u.nscookiejar.filepath);
106 fd = open(cache->cache.info.u.nscookiejar.filepath,
111 cache->cache.info.u.nscookiejar.filepath);
119 nsc_backing_close_unlock(lws_cache_nscookiejar_t *cache, int fd)
126 cache->cache.info.u.nscookiejar.filepath);
150 nscookiejar_iterate(lws_cache_nscookiejar_t *cache, int fd,
190 e = cb(cache, opaque, r | LCN_EOL, temp,
218 e = cb(cache, opaque,
307 lws_cache_nscookiejar_tag_match(struct lws_cache_ttl_lru *cache,
319 * using lookup rules that apply at this cache level.
427 nsc_lookup_cb(lws_cache_nscookiejar_t *cache, void *opaque, int flags,
453 if (lws_cache_nscookiejar_tag_match(&cache->cache,
464 ctx->match = lws_fi(&cache->cache.info.cx->fic, "cache_lookup_oom") ? NULL :
487 lws_cache_nscookiejar_t *cache = (lws_cache_nscookiejar_t *)_c;
491 fd = nsc_backing_open_lock(cache, LWS_O_RDONLY, __func__);
500 ret = nscookiejar_iterate(cache, fd, nsc_lookup_cb, &ctx);
506 nsc_backing_close_unlock(cache, fd);
540 nsc_regen_cb(lws_cache_nscookiejar_t *cache, void *opaque, int flags,
557 if (!cache->earliest_expiry ||
558 (expiry && cache->earliest_expiry > expiry))
559 cache->earliest_expiry = expiry;
569 !lws_cache_nscookiejar_tag_match(&cache->cache,
581 cache->cache.current_footprint += (uint64_t)size;
599 nsc_regen(lws_cache_nscookiejar_t *cache, const char *wc_delete,
606 fd = nsc_backing_open_lock(cache, LWS_O_RDONLY, __func__);
611 cache->cache.info.u.nscookiejar.filepath);
614 if (lws_fi(&cache->cache.info.cx->fic, "cache_regen_temp_open"))
623 if (lws_fi(&cache->cache.info.cx->fic, "cache_regen_temp_write") ||
637 cache->cache.current_footprint = 0;
645 cache->earliest_expiry = 0;
647 if (lws_fi(&cache->cache.info.cx->fic, "cache_regen_iter_fail") ||
648 nscookiejar_iterate(cache, fd, nsc_regen_cb, &ctx))
654 if (unlink(cache->cache.info.u.nscookiejar.filepath) == -1)
656 cache->cache.info.u.nscookiejar.filepath);
657 if (rename(filepath, cache->cache.info.u.nscookiejar.filepath) == -1)
659 cache->cache.info.u.nscookiejar.filepath);
661 if (cache->earliest_expiry)
662 lws_cache_schedule(&cache->cache, expiry_cb,
663 cache->earliest_expiry);
674 nsc_backing_close_unlock(cache, fd);
682 lws_cache_nscookiejar_t *cache = lws_container_of(sul,
683 lws_cache_nscookiejar_t, cache.sul);
689 if (nsc_regen(cache, NULL, NULL, 0))
692 if (cache->earliest_expiry)
693 lws_cache_schedule(&cache->cache, expiry_cb,
694 cache->earliest_expiry);
705 lws_cache_nscookiejar_t *cache = (lws_cache_nscookiejar_t *)_c;
718 if (nsc_regen(cache, tag, source, size)) {
742 nsc_get_cb(lws_cache_nscookiejar_t *cache, void *opaque, int flags,
806 /* dump the buflist into the L1 cache entry */
831 lws_cache_nscookiejar_t *cache = (lws_cache_nscookiejar_t *)_c;
835 fd = nsc_backing_open_lock(cache, LWS_O_RDONLY, __func__);
840 ctx.l1 = &cache->cache;
850 ret = nscookiejar_iterate(cache, fd, nsc_get_cb, &ctx);
852 nsc_backing_close_unlock(cache, fd);
861 lws_cache_nscookiejar_t *cache = (lws_cache_nscookiejar_t *)_c;
863 return nsc_regen(cache, wc_key, NULL, 0);
869 lws_cache_nscookiejar_t *cache;
871 cache = lws_fi(&info->cx->fic, "cache_createfail") ? NULL :
872 lws_zalloc(sizeof(*cache), __func__);
873 if (!cache)
876 cache->cache.info = *info;
882 expiry_cb(&cache->cache.sul);
886 return (struct lws_cache_ttl_lru *)cache;
892 lws_cache_nscookiejar_t *cache = (lws_cache_nscookiejar_t *)_c;
895 if (!cache)
898 r = unlink(cache->cache.info.u.nscookiejar.filepath);
901 cache->cache.info.u.nscookiejar.filepath);
909 lws_cache_nscookiejar_t *cache = (lws_cache_nscookiejar_t *)*_pc;
911 if (!cache)
914 lws_sul_cancel(&cache->cache.sul);
922 nsc_dump_cb(lws_cache_nscookiejar_t *cache, void *opaque, int flags,
933 lws_cache_nscookiejar_t *cache = (lws_cache_nscookiejar_t *)_c;
934 int fd = nsc_backing_open_lock(cache, LWS_O_RDONLY, __func__);
941 nscookiejar_iterate(cache, fd, nsc_dump_cb, NULL);
943 nsc_backing_close_unlock(cache, fd);