Modification of behaviour in response to changes in the environment or ambientconditions, based on memory, is typical of the human and, possibly, many animalspecies.One obvious example of such adaptivity is, for instance, switching to a saferbehaviour when in danger, from either a predator or an infectious disease. In humansociety such switching to safe behaviour is particularly apparent during epidemics.Mathematically, such changes of behaviour in response to changes in the ambient conditionscan be described by models involving switching. In most cases, this switching is assumedto depend on the system state, and thus it disregards the history and, therefore, memory.Memory can be introduced into a mathematical model using a phenomenon known as hysteresis.We illustrate this idea using a simple SIR compartmental model that is applicable inepidemiology. Our goal is to show why and how hysteresis can arise in such a model, andhow it may be applied to describe a variety of memory effects. Our other objective is tointroduce a unified paradigm for mathematical modelling with memory effects inepidemiology and ecology. Our approach treats changing behaviour as an irreversible flowrelated to large ensembles of elementary exchange operations that recently has beensuccessfully applied in a number of other areas, such as terrestrial hydrology, andmacroeconomics. For the purposes of illustrating these ideas in an application to biology,we consider a rather simple case study and develop a model from first principles. Weaccompany the model with extensive numerical simulations which exhibit interestingqualitative effects.