Bacteria have individual lives, and also collective lives. They can form films that support a communal existence, protecting one another at a cost in individual autonomy.
In this study published last month, bacteria remember the surface they were attached to and pass this information along to their offspring. This is learning, combined with inter-generational memory. Bacteria are the smaller kind of one-celled orgnisms, and science has no understanding of how memory is stored. The article doesn't describe a mechanism. The most likely candidate would be epigenetic. In other words, markers on the DNA that tell what genes to turn on and off are persistent, and can be passed to offsring when the DNA is copied.
James Shapiro has written a book describing how bacteria modify their own DNA. This is full Lamarckian adaptation.