In the study of some dynamical systems the limsup set of a sequence of measurable sets is often of interest. The shrinking targets and recurrence are two of the most commonly studied problems that concern limsup sets. However, the zero-one laws for the shrinking targets and recurrence are usually treated separately and proved differently. In this paper, we introduce a generalized definition that can specialize into the shrinking targets and recurrence; our approach gives a unified proof of the zero-one laws for the two problems.