I have a web application which establishes many FTP or SFTP connections with outside servers. Its interface uses AJAX, and via AJAX I get file listings on remote FTP servers and return those to the client browser.
Each time I run an AJAX call, I have to reconnect to the remote server and reauthenticate. This takes a ton of extra time.
Is there a way I can somehow store FTP connection resource objects in some common memory pool and re-access to the connection resource objects with future AJAX calls? I tried Memcached, but it looks like it's not possible to store connection resources there. Maybe I could store them in a thread and somehow access them there? Any other ideas?
I could always have a daemon manage connections and act as a proxy, but that feels overkill.