Generalized persistence modules and some of their invariants