(String name)
| 20 | } |
| 21 | |
| 22 | public String fetch(String name) { |
| 23 | String content = cache.get(name); |
| 24 | if (!TextUtils.isEmpty(content)) return content; |
| 25 | if (name.startsWith("http")) cache.put(name, content = OkHttp.string(name)); |
| 26 | else if (name.startsWith("assets")) cache.put(name, content = Asset.read(name)); |
| 27 | else if (name.startsWith("lib/")) cache.put(name, content = Asset.read("js/" + name)); |
| 28 | return content; |
| 29 | } |
| 30 | |
| 31 | public void clear() { |
| 32 | cache.evictAll(); |