is to filter the content submitted by the user for sensitive words. If the sensitive words are stored in the database, write a sensitive word filtering function (query the sensitive words from the database).
If the user submits content, it will be called This function means that the database must be queried every time, so the design feels unreasonable.
I would like to ask how to design the sensitive word filtering more rationally. Is it okay to write the sensitive words into the configuration file of the project and not store them in the database?
擁有18年軟件開(kāi)發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級(jí)軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...
Yes, you can separate the inscriptions by separators and save them into a text file, or directly use a script to generate json and save it into the file. When reading, parse and read directly.
There is also a faster way. If there are not too many inscriptions (only a few hundred to 2 or 3 thousand), you can directly save them in a configuration file in the form of an array and return an array. The array is retrieved directly each time.