2 Copyright (C) 2011 Samsung Electronics
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
22 * @brief Collection of cache APIs.
35 * Initializes soup cache at specified path
37 * @param cachePath path for a directory when cached files will be stored
38 * @param shared allows to choose between shared and single user cache
39 * @return EINA_TRUE if soup_session_add_feature was called, EINA_FALSE otherwise
41 EAPI Eina_Bool ewk_cache_init(const char* cachePath, Eina_Bool shared);
44 * Loads files cached by soup cache
46 * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
48 EAPI Eina_Bool ewk_cache_load();
53 * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
55 EAPI Eina_Bool ewk_cache_dump();
58 * Forces all pending writes in cache to be committed to disk
60 * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
62 EAPI Eina_Bool ewk_cache_flush();
65 * Finalizes soup cache
67 EAPI void ewk_cache_finalize();
70 * Clears whole soup cache
72 * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
74 EAPI Eina_Bool ewk_cache_clear();
77 * Used for reseting WebKit's component memory.
79 * @return @c EINA_FALSE if succeed, or @c EINA_FALSE otherwise
81 EAPI Eina_Bool ewk_cache_component_reset();
84 * Used for removing WebKit't cache resources (live and dead resources)
86 * @return @c EINA_TRUE if succeed, or @c EINA_FALSE otherwise
88 EAPI Eina_Bool ewk_cache_component_prune();
91 * Used for WebKit's font invalidation
93 * @return @c EINA_TRUE if succeed, or @c EINA_FALSE otherwise
95 EAPI Eina_Bool ewk_cache_font_invalidate();
98 * Page cache capacity functions
99 * Capacity is measured in number of cached pages
100 * Returns page cache capacity
102 * @return size of a page cache
104 EAPI int ewk_cache_page_capacity_get();
107 * Sets page cache capacity
109 * @param capacity size of page cache
111 EAPI void ewk_cache_page_capacity_set(int capacity);
114 * Used for removing WebKit's page cache
116 * @param val sets level of capacity
117 * @return @c EINA_TRUE if succeed, or @c EINA_FALSE otherwise
119 EAPI Eina_Bool ewk_cache_page_release(int val);
122 * Sets maximum size of cache in bytes
124 * @param size size of cache in bytes
125 * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
127 EAPI Eina_Bool ewk_cache_max_size_set(unsigned int size);
130 * Gets maximum size of cache in bytes
132 * @return size of cache in bytes if webkit_soup_cache was initialized, 0 otherwise
134 EAPI unsigned int ewk_cache_max_size_get();
137 * Sets maximum number of bytes that dead resources consume
138 * when the cache is under pressure
140 * @param val new value of cache
142 EAPI void ewk_cache_min_dead_bytes_set(unsigned val);
145 * Returns maximum number of bytes that dead resources consume
146 * when the cache is under pressure
148 * @return maximum number of bytes when cache is under pressure
150 EAPI unsigned ewk_cache_min_dead_bytes_get();
153 * Returns maximum number of bytes that dead resources consume
154 * when the cache is not under pressure
156 * @param val new value of cache
158 EAPI void ewk_cache_max_dead_bytes_set(unsigned val);
161 * Returns maximum number of bytes that dead resources consume
162 * when the cache is under pressure
164 * @return maximum number of bytes when cache is under pressure
166 EAPI unsigned ewk_cache_max_dead_bytes_get();
170 * Sets number of total bytes that deade resources consume.
171 * WebCore also prunes dead and live resources
173 * @param val new value of total cache
175 EAPI void ewk_cache_max_total_bytes_set(unsigned val);
178 * Returns number of bytes that cache consumes overall
180 * @return total number of bytes
182 EAPI unsigned ewk_cache_max_total_bytes_get();
185 * Control soup cache and memory cache usage.
187 * @param enable set cache enable or disable.
189 EAPI void ewk_cache_control_set(Eina_Bool enable);
192 * Return whether soup cache and memory cache enabled or disabled.
194 * @return true if cache is enabled.
196 EAPI Eina_Bool ewk_cache_control_get();
201 #endif // ewk_cache_h