In a general physical system we generally have through variables and across variables. We also have flow and effort variables. See Vibration and Shock Handbook - Silva.
In an electrical network current is the through and flow variable and voltage is the across and effort variable. In the network picture of an electrical circuit the nodes are ideal wires (i.e. interconnects) and linear circuit elements are edges between these nodes. Each node has a corresponding voltage so we speak of the voltage across an element. Each edge has current flowing through it so we speak of the current through an element.
In a mechanical network velocity is the across and flow variable and force is the through and effort variable. In the network picture of a mechanical circuit the nodes are chunks of matter and the edges between the nodes are springs and dampers between the nodes. Each node has a velocity associated with it so, thinking of the voltage difference between the two nodes connected by an edge, we speak of the velocity difference across an element. Each element has a force acting on the two elements it connects so we speak of the force through the element (this is a little bit of a stretch but it's not too bad).
In electricity we have current $I$, its integral charge $Q$ and its derivative change in current over time $\dot{I}$.
In mechanics we have velocity $v$, its integral position $x$ and its derivative acceleration $a$.
In electricity a capacitor relates $Q$ and $V$:
$$
C = \frac{Q}{V} = \frac{\int I dt}{V} = \frac{1}{s} \frac{I}{V}
$$
$Q$ is the integral of the through/flow variable $I$.
The analogous element for a mechanical circuit is the Hookian spring element.
$$
\frac{1}{k} = \frac{x}{F} = \frac{\int xdt}{F} = \frac{1}{s} \frac{v}{F}
$$
Generically impedance is the ratio of the effort to flow variable.
$$
Z \sim \frac{V}{I}\sim \frac{F}{v} \sim \frac{\text{Effort}}{\text{Flow}}
$$
We see that if impedance is high a large effort results in only a small flow.
So we see the electrical impedance of a capacitor is $1/Cs$ and the mechanical impedance of a spring is $k/s$.
What, then, generically, is capacitance? Capacitance is a type of impedance. In a physical system that you can parametrize as a network (i.e. a graph) which has through variables associated with each edge and across variables at each node you can also identify these variables also as effort and flow variables. Impedance is then how the effort and flow variables for an edge element are related. Capacitance is a special type of impedance which relates the INTEGRAL of the flow variable with the value of the effort variable. That is, in the frequency domain capacitance is a type of impedance that is proportional to $1/s$.
Electrical capacitance tells us how much charge can be stored at a given voltage. Mechanical capacitance tells us how much position displacement can be sustained at a given force.
Another case of a system that can be treated with a circuit analogy is a ultra high vacuum system at equilibrium pressure. The across/effort variables are chamber pressures, the through/flow variables are flow rates between chambers. Differential pumping apertures act as resistors.