Libproxy handles the pac downloading and parsing transparently for you.
What your app should to:
Create a new ProxyFactory object pf = New ProxyFactory()
For every resource you connect to, check which proxies to use
ProxiesToTry=pf.getProxies("http://www.google.com")
(for every URI you connect! Especially with PAC this can be different per URI, like offloading pictures or videos and the like).
[...] connect to the proxy and do your communication
destroy pf object.
As long as the pf object is lying around, the pac file is being cached.
For futher info, feel free to join the devs on #libproxy on freenode (IRC)