Giter Site home page Giter Site logo

pcocproxy's Introduction

pCocProxy as Persistent CocProxy

めんどくさことしない置換プロキシーのキャッシュを永続化した変造版

詳しいことはオリジナルのCocProxyを参照のこと。

使い方

起動時にオプション --presistent をつけるとキャッシュを永続化します。

キャッシュを消すときはオリジナルと同様URLに ?clearcache=1 をつけるか、 キャッシュディレクトリを以下のように消せばOKです。

$ rm -rf /tmp/pcocproxy-cache

オリジナルとの相違点

オリジナルはキャッシュとしてHashを利用していて、オンメモリで処理しており、 かつプロセスを終了させるとキャッシュは消えてしまいました。

この実装は速度がめちゃくちゃ速い利点がありました。 しかしせっかくためたキャッシュが綺麗さっぱりなくなってしまうとか、 メモリが厳しい環境で大量のキャッシュを保持すると泣きたくなるとか、 いろいろありました。というか私が泣きそうになりました。

なので多少速度は落ちますが、キャッシュをファイルに保持するようにして、 メモリをあんまり使わないこととキャッシュの永続化をはかりました。

「使い方」で書いたとおり、永続化オプションは --persistent です。 この場合はデフォルトのキャッシュディレクトリ /tmp/pcocproxy-cache を使います。 --persistent=/path/to/cache/dir のようにディレクトリを指定することもできます。

TODO

やるかどうかはしらんけどやるべきこと;

  • proxy-config.yamlで設定できるようにすべき
  • キャッシュのデフォルトディレクトリを files の中にすべきか?
  • ファイルの読み書き時にMutexで一律排他処理をかけてるが 性能に悪影響ですよね。なんとかしたいです

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.