Permalink
Browse files

Ability to remove an icon from the cache [completed:10]

git-svn-id: https://potato.codebasehq.com/getfavicon/getfavicon.svn/trunk@21 0c1c7bd3-9391-4859-b94e-4e2dcdc6a516
  • Loading branch information...
1 parent b49d183 commit 96a96a023dfca4c49cc41fe12203e9ef9f1c063f jason committed Aug 22, 2010
Showing with 15 additions and 0 deletions.
  1. +12 −0 main.py
  2. +3 −0 templates/index.html
View
12 main.py
@@ -100,6 +100,17 @@ def get(self):
})
+class Decache(BaseHandler):
+
+ def get(self):
+
+ domain = self.request.get("domain")
+ memcache.delete("icon-" + domain)
+
+ deleteQuery = db.GqlQuery("SELECT __key__ FROM favIcon WHERE domain = :1", domain)
+ db.delete(deleteQuery.fetch(100))
+
+
class TestPage(BaseHandler):
def get(self):
@@ -388,6 +399,7 @@ def main():
application = webapp.WSGIApplication(
[
('/', IndexPage),
+ ('/decache/', Decache),
('/test/', TestPage),
('/_cleanup', cleanup),
('/_deleteall', deleteAll),
View
@@ -25,6 +25,9 @@
<p>To improve the performance of pages with many favicons on them you can overcome <a href="http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/">browser connection limits</a> by pointing to the icon on different domains. You can see this in action on the <a href="/test/">test page</a> where we use the first letter of the domain to generate a subdomain name. The domains are of the format...</p>
<pre>http://[whatever].getfavicon.appspot.com/[URL]</pre>
+ <h3>De-cache</h3>
+ <p>You can remove an icon from the cache by calling <code>/decache/?domain=[domain]</code>. E.g. <a href="/decache/?domain=http://www.google.com">/decache/?domain=http://www.google.com</a>.</p>
+
<h2>Examples</h2>
<ul>
<li><a href="/http://code.google.com/appengine/docs/python/urlfetch/fetchfunction.html"><img src="/http://code.google.com/appengine/docs/python/urlfetch/fetchfunction.html" alt="Google Code"/></a> Google Code</li>

0 comments on commit 96a96a0

Please sign in to comment.