Add 'idea' plugin to root project.

Required to get an actual Intellij project, rathe than
just module files.
Add IDEA default "out" directory to .gitignore.
Restructure analytics package.

Simplified package structure.

Moved service and repository implementations to the same
package depending on the backend implementation, since they
are both tightly coupled.

Removed use of reflection to set metric values in favour
of a package-private set method.
XD-44: Extract common redis repository behaviour.

Moved the existing metric name and expiry time code into
a base class. There is still potential for reducing more
duplication, but other changes/metric types may alter
the design, so leaving for now.