<commit_before># OpenCache #

OpenCache is an experimental HTTP caching platform that utilises [OpenFlow-enabled](https://www.opennetworking.org/sdn-resources/onf-specifications/openflow) switches to provide transparent content delivery. It works in a controller-node architecture, described in the [Architecture](https://github.com/broadbent/opencache#architecture) section. 

Progress is quickly advancing, with a number of features to be implemented shortly (see [TODO](https://github.com/broadbent/opencache/TODO.md) for more details).

## Requirements ##

OpenCache is written for Python 2.7 and is tested on Unix platforms. It is recommended that `pip` is used to automatically install OpenCache and any additional dependencies. 

The OpenCache controller uses the [pymongo](https://pypi.python.org/pypi/pymongo/) library to interact with a [MongoDB](http://www.mongodb.org/) database. [pyzmq](https://github.com/zeromq/pyzmq) is required for internal ØMQ messaging. Backported from Python 3.2+ to Python 2.6-2.7, [configparser](https://pypi.python.org/pypi/configparser) is also used for allowing additional flexibility in configuration files.

## Installation ##

### pip ###

To install or upgrade pip, download [get-pip.py](https://raw.github.com/pypa/pip/master/contrib/get-pip.py).

Then run the following (which may require administrator access):

```bash
$ python get-pip.py
```

For more detailed instructions and alternative installation methods, please visit the [pip](http://www.pip-installer.org/en/latest/installing.html) website.

### opencache ###

OpenCache can be installed easily using `pip` and [PyPi](https://pypi.python.org/pypi):

```bash
$ pip install opencache --pre
```

As OpenCache is still in a pre-release phase, it is necessary to use the `--pre` flag at the moment (to retrieve _any_ release).

Alternatively, `distutils` can be used to install OpenCache from source. Simply download the compressed repository, uncompress, and run:

```bash
$ python setup.py install
```

## Running OpenCache ##

OpenCache is split into two parts: the controller and the node. See the [Architecture](https://github.com/broadbent/opencache/README.md#architecture) section for more details. 

To run the OpenCache controller, simply use:
```bash
$ opencache --controller --config="PATH_TO_CONFIG"
```

Similarly, to run the OpenCache node, use:
```bash
$ opencache --node --config="PATH_TO_CONFIG"
```

Sample configuration files are included in `example\config` directory for both a controller and a node (see `controller.conf` and `node.conf` respectively). Runtime output is written to both a log file and to `stdout`. The destination file for this log can be specified in the  configuration file.<commit_msg>Correct typo in licensing information<commit_after># OpenCache #

OpenCache is an experimental HTTP caching platform that utilises [OpenFlow-enabled](https://www.opennetworking.org/sdn-resources/onf-specifications/openflow) switches to provide transparent content delivery. It works in a controller-node architecture, described in the [Architecture](https://github.com/broadbent/opencache#architecture) section.

Progress is quickly advancing, with a number of features to be implemented shortly (see [TODO](https://github.com/broadbent/opencache/TODO.md) for more details).

## Requirements ##

OpenCache is written for Python 2.7 and is tested on Unix platforms. It is recommended that `pip` is used to automatically install OpenCache and any additional dependencies.

The OpenCache controller uses the [pymongo](https://pypi.python.org/pypi/pymongo/) library to interact with a [MongoDB](http://www.mongodb.org/) database. [pyzmq](https://github.com/zeromq/pyzmq) is required for internal ØMQ messaging. Backported from Python 3.2+ to Python 2.6-2.7, [configparser](https://pypi.python.org/pypi/configparser) is also used for allowing additional flexibility in configuration files.

## Installation ##

### pip ###

To install or upgrade pip, download [get-pip.py](https://raw.github.com/pypa/pip/master/contrib/get-pip.py).

Then run the following (which may require administrator access):

```bash
$ python get-pip.py
```

For more detailed instructions and alternative installation methods, please visit the [pip](http://www.pip-installer.org/en/latest/installing.html) website.

### opencache ###

OpenCache can be installed easily using `pip` and [PyPi](https://pypi.python.org/pypi):

```bash
$ pip install opencache --pre
```

As OpenCache is still in a pre-release phase, it is necessary to use the `--pre` flag at the moment (to retrieve _any_ release).

Alternatively, `distutils` can be used to install OpenCache from source. Simply download the compressed repository, uncompress, and run:

```bash
$ python setup.py install
```

## Running OpenCache ##

OpenCache is split into two parts: the controller and the node. See the [Architecture](https://github.com/broadbent/opencache/README.md#architecture) section for more details.

To run the OpenCache controller, simply use:
```bash
$ opencache --controller --config="PATH_TO_CONFIG"
```

Similarly, to run the OpenCache node, use:
```bash
$ opencache --node --config="PATH_TO_CONFIG"
```

Sample configuration files are included in `example\config` directory for both a controller and a node (see `controller.conf` and `node.conf` respectively). Runtime output is written to both a log file and to `stdout`. The destination file for this log can be specified in the  configuration file.
{'fraction_non_alphanumeric': 0.10610756608933455, 'fraction_numerical': 0.0029170464904284413, 'mean_word_length': 4.937229437229437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3413806', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1486, 'n_words': 591}