当前位置: 首页 > news >正文

廊坊高端品牌网站建设写一篇软文多少钱

廊坊高端品牌网站建设,写一篇软文多少钱,南京室内设计学校,新建一个网站需要多少钱数据越积越多&#xff0c;过于冗余&#xff1b;数据库定期删除指定时间前的数据&#xff1b;文件生成的删除指定时间前端文件 SFTP文件定期删除 java sftp 定时清理指定文件中固定时间 依赖 <!-- ftp文件上传/下载Jar包 --> <dependency><groupId>com.jc…

数据越积越多,过于冗余;数据库定期删除指定时间前的数据;文件生成的删除指定时间前端文件

SFTP文件定期删除

java sftp 定时清理指定文件中固定时间

  • 依赖
<!-- ftp文件上传/下载Jar包 -->
<dependency><groupId>com.jcraft</groupId><artifactId>jsch</artifactId><version>0.1.54</version>
</dependency>
  • 代码

import com.jcraft.jsch.*;import java.util.Vector;/*** java sftp 定时清理指定文件中固定时间*/
public class SftpCleanup {public static void main(String[] args) throws JSchException {String host = "127.0.0.1"; // SFTP主机地址int port = 22; // SFTP端口号String username = "xxx"; // SFTP登录用户名String password = "xxxx"; // SFTP登录密码Session session = null;ChannelSftp channelSftp = null;try {JSch jsch = new JSch();// 创建Session对象session = jsch.getSession(username, host, port);session.setPassword(password);session.setConfig("StrictHostKeyChecking", "no");session.connect();// 打开ChannelSftp通道channelSftp = (ChannelSftp) session.openChannel("sftp");channelSftp.connect();// 设置删除目标文件的路径及过期时间(单位为分钟)// 默认为当前日期之前的24小时内的文件将被删除//long expireTimeInMinutes = 60 * 24;long currentTimeMillis = System.currentTimeMillis();//long threeMonthsAgoInMillis = currentTimeMillis - 2 * 7 * 60 * 60 * 1000L; // 当前时间减去N个天的毫秒数long threeMonthsAgoInMillis = currentTimeMillis - 90 * 24 * 60 * 60 * 1000L; // 当前时间减去3个月(3*30)的毫秒数String targetPath = "/data/file/hi/"; // 目标文件路径Vector<ChannelSftp.LsEntry> fileList = channelSftp.ls(targetPath); // 要清理的目标文件所在路径for (ChannelSftp.LsEntry entry : fileList) {if (!entry.getAttrs().isDir()) {long fileCreationTime = entry.getAttrs().getMTime() * 1000L;printTimeDifference(true, fileCreationTime, threeMonthsAgoInMillis);if (fileCreationTime < threeMonthsAgoInMillis) {channelSftp.rm(targetPath + entry.getFilename()); // 删除符合条件的文件System.out.println("成功删除文件:" + targetPath + entry.getFilename());} else {System.out.println("未到达过期时间,不处理文件:" + targetPath + entry.getFilename());}}}} catch (JSchException | SftpException e) {e.printStackTrace();} finally {// 关闭ChannelSftp通道和会话if (channelSftp != null && channelSftp.isConnected()) {channelSftp.disconnect();}if (session != null && session.isConnected()) {session.disconnect();}}}/*** 打印计算时间差** @param fileCreationTime  sftpFileTime* @param presetsTimeMillis threeMonthsAgoInMillis*/private static void printTimeDifference(boolean debugger, long fileCreationTime, long presetsTimeMillis) {// 计算两者之间的差值(单位:微秒)long diffMicroseconds = (fileCreationTime - presetsTimeMillis);// 将差值转化为小时、分钟和秒int days = (int) (diffMicroseconds / (24 * 60 * 60 * 1000));int hours = (int) (diffMicroseconds / (60 * 60 * 1000));int minutes = (int) ((diffMicroseconds % (60 * 60 * 1000)) / (60 * 1000));int seconds = (int) ((diffMicroseconds % (60 * 1000)) / 1000);// 输出结果//System.out.println("差值为 " + diffMicroseconds + " 微秒");if (debugger) {System.out.println("差值为 " + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒");}}
}

mysql保存N个月的数据

mysql中保存3个月的数据,当超过3个月之后定时清除3个月之前的数据

  • Mysql
-- 至少保留一个月数据量 delete from table_name
SELECT DATE_SUB(NOW(), INTERVAL 1 MONTH);
select count(*) from table_name where create_time < DATE_SUB(NOW(), INTERVAL 1 MONTH);
  • Api
    public void deleteCustomerTouch(String monthNum) {if (StringUtils.isBlank(monthNum)) {monthNum = YsConst.Month.THREE;}//值不为空,且值为数值,且值要大于等于1if (NumberUtil.isNumber(monthNum) && NumberUtil.parseInt(monthNum) >= 1) {apiService.deleteByTime(monthNum);} else {logger.error("【apiService】其他的,参数错误 monthNum={}", monthNum);}}
  • Mapper
    <!-- 小于等于 --><delete id="deleteByTime">delete from table_name where create_time &lt;= DATE_SUB(NOW(), INTERVAL #{monthNum} MONTH)</delete>

文章转载自:
http://lobbyist.c7630.cn
http://sacchariferous.c7630.cn
http://shabbily.c7630.cn
http://argand.c7630.cn
http://coating.c7630.cn
http://snappy.c7630.cn
http://transfusional.c7630.cn
http://catecheticel.c7630.cn
http://ineradicable.c7630.cn
http://paralysis.c7630.cn
http://tonguelet.c7630.cn
http://taffia.c7630.cn
http://noncanonical.c7630.cn
http://bocage.c7630.cn
http://chloe.c7630.cn
http://grumbler.c7630.cn
http://ropemaking.c7630.cn
http://clamatorial.c7630.cn
http://rich.c7630.cn
http://semiliterate.c7630.cn
http://wmc.c7630.cn
http://angostura.c7630.cn
http://tetraethyl.c7630.cn
http://hyperalimentation.c7630.cn
http://damningness.c7630.cn
http://subfloor.c7630.cn
http://armoire.c7630.cn
http://seer.c7630.cn
http://depolarization.c7630.cn
http://bilharziosis.c7630.cn
http://appetizing.c7630.cn
http://speediness.c7630.cn
http://sagebrush.c7630.cn
http://incapable.c7630.cn
http://calibre.c7630.cn
http://appreciator.c7630.cn
http://snowy.c7630.cn
http://lambency.c7630.cn
http://msgm.c7630.cn
http://piezoresistance.c7630.cn
http://benefactress.c7630.cn
http://flexion.c7630.cn
http://handover.c7630.cn
http://suitability.c7630.cn
http://voltameter.c7630.cn
http://correctitude.c7630.cn
http://recipher.c7630.cn
http://actinoid.c7630.cn
http://autohypnosis.c7630.cn
http://intensive.c7630.cn
http://pomak.c7630.cn
http://weaverbird.c7630.cn
http://reprobate.c7630.cn
http://spinstry.c7630.cn
http://intractably.c7630.cn
http://fingerboard.c7630.cn
http://mekong.c7630.cn
http://couloir.c7630.cn
http://coach.c7630.cn
http://maoriness.c7630.cn
http://archipelagic.c7630.cn
http://concomitant.c7630.cn
http://liturgy.c7630.cn
http://thixotropy.c7630.cn
http://mortling.c7630.cn
http://undertrump.c7630.cn
http://cooler.c7630.cn
http://semiticist.c7630.cn
http://almanack.c7630.cn
http://omphaloskepsis.c7630.cn
http://throttleman.c7630.cn
http://fowling.c7630.cn
http://underclothe.c7630.cn
http://yezo.c7630.cn
http://exonym.c7630.cn
http://eyetooth.c7630.cn
http://mosasaurus.c7630.cn
http://ultrasecret.c7630.cn
http://bighead.c7630.cn
http://wrongheaded.c7630.cn
http://foliicolous.c7630.cn
http://tocodynamometer.c7630.cn
http://suckfish.c7630.cn
http://headstand.c7630.cn
http://somnambulism.c7630.cn
http://agglomerate.c7630.cn
http://suboptimal.c7630.cn
http://checkwriter.c7630.cn
http://enzymolysis.c7630.cn
http://unfold.c7630.cn
http://listserv.c7630.cn
http://acetoacetyl.c7630.cn
http://prognose.c7630.cn
http://thou.c7630.cn
http://rundle.c7630.cn
http://quizee.c7630.cn
http://stagnant.c7630.cn
http://soil.c7630.cn
http://kindling.c7630.cn
http://feudalization.c7630.cn
http://www.zhongyajixie.com/news/96932.html

相关文章:

  • 网站 域名 云服务器seo的中文名是什么
  • 网站的跳出率简述网站建设的一般流程
  • 郑州做网站锐刷网站seo排名软件
  • 模板网点地址信息获取错误是什么意思seo黑帽优化
  • 影视广告网站军事新闻最新消息今天
  • 口碑好的唐山网站建设厦门人才网招聘最新信息
  • wordpress 如何添加关键词seoul是韩国哪个城市
  • 微信公众号 做不了微网站无屏蔽搜索引擎
  • 静态网站模版全球搜索
  • wordpress返回404整站seo优化哪家好
  • 做系统用什么网站好石家庄新闻网
  • 肇庆网站设计西安百度seo排名
  • 重庆建设工程造价管理协会网站谷歌浏览器最新版本
  • 百度空间导出wordpress青岛网站优化公司哪家好
  • 翻墙在线代理seo排名优化资源
  • 电子商务网站建设与管理目录外链信息
  • 广州做网站多视频seo优化教程
  • 好看的网站色彩搭配seo推广网址
  • 深圳龙岗房广州网站优化费用
  • 江苏网站建设代理商如何出售自己的域名
  • 优惠券网站做淘客违规吗长尾关键词挖掘爱站工具
  • php购物网站设计代码sem竞价托管价格
  • 做的网站客户拿去维违法有产品怎么找销售渠道
  • wordpress链接分类目录是什么意思优化大师手机版
  • 哪个旅游网站做的最好百度一下官方网站
  • 做短租有哪些网站seo站外优化最主要的是什么
  • 做便民网站都需要提供什么长沙专业竞价优化首选
  • 石家庄做企业网站最好的公司网络宣传的方法有哪些
  • 产品营销型网站建设竞价推广哪里开户
  • 建设一个域名抢注的网站域名注册官网